The quilt patch titled Subject: mm/khugepaged: don't check pmd value twice in collapse_pte_mapped_thp() has been removed from the -mm tree. Its filename was mm-madvise-add-file-and-shmem-support-to-madv_collapse-fix.patch This patch was dropped because it was folded into mm-madvise-add-file-and-shmem-support-to-madv_collapse.patch ------------------------------------------------------ From: "Zach O'Keefe" <zokeefe@xxxxxxxxxx> Subject: mm/khugepaged: don't check pmd value twice in collapse_pte_mapped_thp() Date: Mon, 26 Sep 2022 20:38:54 -0700 During the v3 -> v4 merge of series "mm: add file/shmem support to MADV_COLLAPSE", a line deletion was accidentally dropped, which left collapse_pte_mapped_thp() in state: ---8<--- <mmap_lock held exclusively> result = find_pmd_or_thp_or_none(mm, haddr, &pmd); <other checks that don't change "result" unless fail> (*) if (find_pmd_or_thp_or_none(mm, haddr, &pmd) != SCAN_SUCCEED) result = find_pmd_or_thp_or_none(mm, haddr, &pmd); switch (result) { case SCAN_SUCCEED: ---8<--- Where (*) is the line that should have been deleted (note that this is still legal C). Since the selftests are still passing, this mistake highlights the fact that the second (intended) find_pmd_or_thp_or_none() isn't necessary: the first one is called with mmap_lock held exclusively, we don't drop the lock in this function, and "result" isn't changed between assignment and use in the switch-statement (except for failure paths which either return early or skip to "drop_hpage" label). Remove the second (intended) find_pmd_or_thp_or_none() check, and the misplaced find_pmd_or_thp_or_none() if-statement line. Link: https://lkml.kernel.org/r/20220927033854.477018-1-zokeefe@xxxxxxxxxx Fixes: c27451af51cc ("mm/madvise: add file and shmem support to MADV_COLLAPSE") Signed-off-by: Zach O'Keefe <zokeefe@xxxxxxxxxx> Signed-off-by: Andrew Morton <akpm@xxxxxxxxxxxxxxxxxxxx> --- mm/khugepaged.c | 2 -- 1 file changed, 2 deletions(-) --- a/mm/khugepaged.c~mm-madvise-add-file-and-shmem-support-to-madv_collapse-fix +++ a/mm/khugepaged.c @@ -1463,8 +1463,6 @@ int collapse_pte_mapped_thp(struct mm_st goto drop_hpage; } - if (find_pmd_or_thp_or_none(mm, haddr, &pmd) != SCAN_SUCCEED) - result = find_pmd_or_thp_or_none(mm, haddr, &pmd); switch (result) { case SCAN_SUCCEED: break; _ Patches currently in -mm which might be from zokeefe@xxxxxxxxxx are mm-khugepaged-check-compound_order-in-collapse_pte_mapped_thp.patch mm-madvise-madv_collapse-return-eagain-when-page-cannot-be-isolated.patch selftests-vm-retry-on-eagain-for-madv_collapse-selftest.patch mm-shmem-add-flag-to-enforce-shmem-thp-in-hugepage_vma_check.patch mm-khugepaged-attempt-to-map-file-shmem-backed-pte-mapped-thps-by-pmds.patch mm-madvise-add-file-and-shmem-support-to-madv_collapse.patch mm-khugepaged-add-tracepoint-to-hpage_collapse_scan_file.patch selftests-vm-dedup-thp-helpers.patch selftests-vm-modularize-thp-collapse-memory-operations.patch selftests-vm-add-thp-collapse-file-and-tmpfs-testing.patch selftests-vm-add-thp-collapse-shmem-testing.patch selftests-vm-add-file-shmem-madv_collapse-selftest-for-cleared-pmd.patch selftests-vm-add-selftest-for-madv_collapse-of-uffd-minor-memory.patch