The patch titled Subject: mm-uffd-uffd_feature_wp_unpopulated-fix has been added to the -mm mm-unstable branch. Its filename is mm-uffd-uffd_feature_wp_unpopulated-fix.patch This patch will shortly appear at https://git.kernel.org/pub/scm/linux/kernel/git/akpm/25-new.git/tree/patches/mm-uffd-uffd_feature_wp_unpopulated-fix.patch This patch will later appear in the mm-unstable branch at git://git.kernel.org/pub/scm/linux/kernel/git/akpm/mm 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 via the mm-everything branch at git://git.kernel.org/pub/scm/linux/kernel/git/akpm/mm and is updated there every 2-3 working days ------------------------------------------------------ From: Peter Xu <peterx@xxxxxxxxxx> Subject: mm-uffd-uffd_feature_wp_unpopulated-fix Date: Tue, 21 Mar 2023 16:09:26 -0400 Two comment changes suggested by David, and also a oneliner fix to khugepaged (to bail out anon thp collapsing when seeing pte markers). Link: https://lkml.kernel.org/r/ZB2/8jPhD3fpx5U8@x1n Signed-off-by: Peter Xu <peterx@xxxxxxxxxx> Cc: Andrea Arcangeli <aarcange@xxxxxxxxxx> Cc: Axel Rasmussen <axelrasmussen@xxxxxxxxxx> Cc: David Hildenbrand <david@xxxxxxxxxx> Cc: Mike Rapoport <rppt@xxxxxxxxxxxxxxxxxx> Cc: Muhammad Usama Anjum <usama.anjum@xxxxxxxxxxxxx> Cc: Nadav Amit <nadav.amit@xxxxxxxxx> Cc: Paul Gofman <pgofman@xxxxxxxxxxxxxxx> Signed-off-by: Andrew Morton <akpm@xxxxxxxxxxxxxxxxxxxx> --- Documentation/admin-guide/mm/userfaultfd.rst | 2 +- mm/khugepaged.c | 2 +- mm/mprotect.c | 4 ++-- 3 files changed, 4 insertions(+), 4 deletions(-) --- a/Documentation/admin-guide/mm/userfaultfd.rst~mm-uffd-uffd_feature_wp_unpopulated-fix +++ a/Documentation/admin-guide/mm/userfaultfd.rst @@ -226,7 +226,7 @@ For anonymous memory, ``ioctl(UFFDIO_WRI (e.g. when pages are missing and not populated). For file-backed memories like shmem and hugetlbfs, none ptes will be write protected just like a present pte. In other words, there will be a userfaultfd write fault -message generated when writting to a missing page on file typed memories, +message generated when writing to a missing page on file typed memories, as long as the page range was write-protected before. Such a message will not be generated on anonymous memories by default. --- a/mm/khugepaged.c~mm-uffd-uffd_feature_wp_unpopulated-fix +++ a/mm/khugepaged.c @@ -1282,7 +1282,7 @@ static int hpage_collapse_scan_pmd(struc * enabled swap entries. Please see * comment below for pte_uffd_wp(). */ - if (pte_swp_uffd_wp(pteval)) { + if (pte_swp_uffd_wp_any(pteval)) { result = SCAN_PTE_UFFD_WP; goto out_unmap; } --- a/mm/mprotect.c~mm-uffd-uffd_feature_wp_unpopulated-fix +++ a/mm/mprotect.c @@ -329,8 +329,8 @@ static inline int pmd_none_or_clear_bad_ } /* - * Return true if we want to split huge thps in change protection - * procedure, false otherwise. + * Return true if we want to split THPs into PTE mappings in change + * protection procedure, false otherwise. */ static inline bool pgtable_split_needed(struct vm_area_struct *vma, unsigned long cp_flags) _ Patches currently in -mm which might be from peterx@xxxxxxxxxx are mm-hugetlb-fix-uffd-wr-protection-for-cow-optimization-path.patch mm-hugetlb-fix-uffd-wr-protection-for-cow-optimization-path-v2.patch mm-khugepaged-alloc_charge_hpage-take-care-of-mem-charge-errors.patch mm-khugepaged-cleanup-memcg-uncharge-for-failure-path.patch mm-uffd-uffd_feature_wp_unpopulated.patch mm-uffd-uffd_feature_wp_unpopulated-fix.patch selftests-mm-smoke-test-uffd_feature_wp_unpopulated.patch mm-thp-rename-transparent_hugepage_never_dax-to-_unsupported.patch mm-thp-rename-transparent_hugepage_never_dax-to-_unsupported-fix.patch