From: Peter Xu Date: Tue, 21 Mar 2023 20:09:26 +0000 (-0400) Subject: mm-uffd-uffd_feature_wp_unpopulated-fix X-Git-Url: https://www.infradead.org/git/?a=commitdiff_plain;h=ed3ba24be0f82e0c5d14e513a8a40491462a85fb;p=users%2Fjedix%2Flinux-maple.git mm-uffd-uffd_feature_wp_unpopulated-fix 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 Cc: Andrea Arcangeli Cc: Axel Rasmussen Cc: David Hildenbrand Cc: Mike Rapoport Cc: Muhammad Usama Anjum Cc: Nadav Amit Cc: Paul Gofman Signed-off-by: Andrew Morton --- diff --git a/Documentation/admin-guide/mm/userfaultfd.rst b/Documentation/admin-guide/mm/userfaultfd.rst index c86b56c95ea6..bd2226299583 100644 --- a/Documentation/admin-guide/mm/userfaultfd.rst +++ b/Documentation/admin-guide/mm/userfaultfd.rst @@ -226,7 +226,7 @@ For anonymous memory, ``ioctl(UFFDIO_WRITEPROTECT)`` will ignore none ptes (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. diff --git a/mm/khugepaged.c b/mm/khugepaged.c index 27956d440413..bee7fd7db380 100644 --- a/mm/khugepaged.c +++ b/mm/khugepaged.c @@ -1178,7 +1178,7 @@ static int hpage_collapse_scan_pmd(struct mm_struct *mm, * 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; } diff --git a/mm/mprotect.c b/mm/mprotect.c index e27bbd0fde6f..b9da9a5f87fe 100644 --- a/mm/mprotect.c +++ b/mm/mprotect.c @@ -329,8 +329,8 @@ static inline int pmd_none_or_clear_bad_unless_trans_huge(pmd_t *pmd) } /* - * 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)