Message ID | 20200720062623.13135-4-bhe@redhat.com (mailing list archive) |
---|---|
State | New, archived |
Headers | show |
Series | mm/hugetlb: Small cleanup and improvement | expand |
On 7/19/20 11:26 PM, Baoquan He wrote: > The checking is_migration_entry() and is_hwpoison_entry() are stricter > than non_swap_entry(), means they have covered the conditional check > which non_swap_entry() is doing. > > Hence remove the unnecessary non_swap_entry() in is_hugetlb_entry_migration() > and is_hugetlb_entry_hwpoisoned() to simplify code. > > Signed-off-by: Baoquan He <bhe@redhat.com> Agreed, we can remove the checks for non_swap_entry. Reviewed-by: Mike Kravetz <mike.kravetz@oracle.com>
On 20.07.20 08:26, Baoquan He wrote: > The checking is_migration_entry() and is_hwpoison_entry() are stricter > than non_swap_entry(), means they have covered the conditional check > which non_swap_entry() is doing. > > Hence remove the unnecessary non_swap_entry() in is_hugetlb_entry_migration() > and is_hugetlb_entry_hwpoisoned() to simplify code. > > Signed-off-by: Baoquan He <bhe@redhat.com> > --- > mm/hugetlb.c | 4 ++-- > 1 file changed, 2 insertions(+), 2 deletions(-) > > diff --git a/mm/hugetlb.c b/mm/hugetlb.c > index a58f976a9dd9..467894d8332a 100644 > --- a/mm/hugetlb.c > +++ b/mm/hugetlb.c > @@ -3748,7 +3748,7 @@ bool is_hugetlb_entry_migration(pte_t pte) > if (huge_pte_none(pte) || pte_present(pte)) > return false; > swp = pte_to_swp_entry(pte); > - if (non_swap_entry(swp) && is_migration_entry(swp)) > + if (is_migration_entry(swp)) > return true; > else > return false; > @@ -3761,7 +3761,7 @@ static bool is_hugetlb_entry_hwpoisoned(pte_t pte) > if (huge_pte_none(pte) || pte_present(pte)) > return false; > swp = pte_to_swp_entry(pte); > - if (non_swap_entry(swp) && is_hwpoison_entry(swp)) > + if (is_hwpoison_entry(swp)) > return true; > else > return false; > Reviewed-by: David Hildenbrand <david@redhat.com>
diff --git a/mm/hugetlb.c b/mm/hugetlb.c index a58f976a9dd9..467894d8332a 100644 --- a/mm/hugetlb.c +++ b/mm/hugetlb.c @@ -3748,7 +3748,7 @@ bool is_hugetlb_entry_migration(pte_t pte) if (huge_pte_none(pte) || pte_present(pte)) return false; swp = pte_to_swp_entry(pte); - if (non_swap_entry(swp) && is_migration_entry(swp)) + if (is_migration_entry(swp)) return true; else return false; @@ -3761,7 +3761,7 @@ static bool is_hugetlb_entry_hwpoisoned(pte_t pte) if (huge_pte_none(pte) || pte_present(pte)) return false; swp = pte_to_swp_entry(pte); - if (non_swap_entry(swp) && is_hwpoison_entry(swp)) + if (is_hwpoison_entry(swp)) return true; else return false;
The checking is_migration_entry() and is_hwpoison_entry() are stricter than non_swap_entry(), means they have covered the conditional check which non_swap_entry() is doing. Hence remove the unnecessary non_swap_entry() in is_hugetlb_entry_migration() and is_hugetlb_entry_hwpoisoned() to simplify code. Signed-off-by: Baoquan He <bhe@redhat.com> --- mm/hugetlb.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-)