The patch titled Subject: mm/hugetlb.c: remove the unnecessary non_swap_entry() has been added to the -mm tree. Its filename is mm-hugetlbc-remove-the-unnecessary-non_swap_entry.patch This patch should soon appear at https://ozlabs.org/~akpm/mmots/broken-out/mm-hugetlbc-remove-the-unnecessary-non_swap_entry.patch and later at https://ozlabs.org/~akpm/mmotm/broken-out/mm-hugetlbc-remove-the-unnecessary-non_swap_entry.patch Before you just go and hit "reply", please: a) Consider who else should be cc'ed b) Prefer to cc a suitable mailing list as well c) Ideally: find the original patch on the mailing list and do a reply-to-all to that, adding suitable additional cc's *** Remember to use Documentation/process/submit-checklist.rst when testing your code *** The -mm tree is included into linux-next and is updated there every 3-4 working days ------------------------------------------------------ From: Baoquan He <bhe@xxxxxxxxxx> Subject: mm/hugetlb.c: remove the unnecessary non_swap_entry() If a swap entry tests positive for either is_[migration|hwpoison]_entry(), then its swap_type() is among SWP_MIGRATION_READ, SWP_MIGRATION_WRITE and SWP_HWPOISON. All these types >= MAX_SWAPFILES, exactly what is asserted with non_swap_entry(). So the checking non_swap_entry() in is_hugetlb_entry_migration() and is_hugetlb_entry_hwpoisoned() is redundant. Let's remove it to optimize code. Link: https://lkml.kernel.org/r/20200723032248.24772-3-bhe@xxxxxxxxxx Signed-off-by: Baoquan He <bhe@xxxxxxxxxx> Reviewed-by: Mike Kravetz <mike.kravetz@xxxxxxxxxx> Reviewed-by: David Hildenbrand <david@xxxxxxxxxx> Reviewed-by: Anshuman Khandual <anshuman.khandual@xxxxxxx> Signed-off-by: Andrew Morton <akpm@xxxxxxxxxxxxxxxxxxxx> --- mm/hugetlb.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) --- a/mm/hugetlb.c~mm-hugetlbc-remove-the-unnecessary-non_swap_entry +++ a/mm/hugetlb.c @@ -3774,7 +3774,7 @@ bool is_hugetlb_entry_migration(pte_t pt 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; @@ -3787,7 +3787,7 @@ static bool is_hugetlb_entry_hwpoisoned( 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; _ Patches currently in -mm which might be from bhe@xxxxxxxxxx are mm-hugetlbc-make-is_hugetlb_entry_hwpoisoned-return-bool.patch mm-hugetlbc-remove-the-unnecessary-non_swap_entry.patch doc-vm-fix-typo-in-the-hugetlb-admin-documentation.patch