mm-shmem-persist-uffd-wp-bit-across-zapping-for-file-backed.patch removed from -mm tree
The quilt patch titled
Subject: mm/shmem: persist uffd-wp bit across zapping for file-backed
has been removed from the -mm tree. Its filename was
mm-shmem-persist-uffd-wp-bit-across-zapping-for-file-backed.patch
This patch was dropped because it was merged into the mm-stable branch\nof git://git.kernel.org/pub/scm/linux/kernel/git/akpm/mm
------------------------------------------------------
From: Peter Xu <[email protected]>
Subject: mm/shmem: persist uffd-wp bit across zapping for file-backed
File-backed memory is prone to being unmapped at any time. It means all information in the pte will be dropped, including the uffd-wp flag.
To persist the uffd-wp flag, we'll use the pte markers. This patch teaches the zap code to understand uffd-wp and know when to keep or drop the uffd-wp bit.
Add a new flag ZAP_FLAG_DROP_MARKER and set it in zap_details when we don't want to persist such an information, for example, when destroying the whole vma, or punching a hole in a shmem file. For the rest cases we should never drop the uffd-wp bit, or the wr-protect information will get lost.
The new ZAP_FLAG_DROP_MARKER needs to be put into mm.h rather than memory.c because it'll be further referenced in hugetlb files later.
---
include/linux/mm.h | 10 +++++++ include/linux/mm_inline.h | 43 +++++++++++++++++++++++++++++++ mm/memory.c | 49 +++++++++++++++++++++++++++++++++--- mm/rmap.c | 8 +++++ 4 files changed, 107 insertions(+), 3 deletions(-)
include/linux/mm.h renamed from include/linux/mm.h~mm-shmem-persist-uffd-wp-bit-across-zapping-for-file-backed +10 -0
@@ -3428,4 +3428,14 @@ madvise_set_anon_name(struct mm_struct * }#endif +typedef unsigned int __bitwise zap_flags_t ; + +/* +* Whether to drop the pte markers, for example, the uffd-wp information for +* file-backed memory. This should only be specified when we will completely +* drop the page in the mm, either by truncation or unmapping of the vma. By +* default, the flag is not set. +*/ +#define ZAP_FLAG_DROP_MARKER ((__force zap_flags_t) BIT(0)) +#endif /* _LINUX_MM_H */
include/linux/mm_inline.h renamed from include/linux/mm_inline.h~mm-shmem-persist-uffd-wp-bit-across-zapping-for-file-backed +43 -0
54 lines not on this page · raw message
mm/memory.c renamed from mm/memory.c~mm-shmem-persist-uffd-wp-bit-across-zapping-for-file-backed +46 -3
108 lines not on this page · raw message
mm/rmap.c renamed from mm/rmap.c~mm-shmem-persist-uffd-wp-bit-across-zapping-for-file-backed +8 -0
@@ -73,6 +73,7 @@#include <linux/page_idle.h> #include <linux/memremap.h> #include <linux/userfaultfd_k.h> +#include <linux/mm_inline.h> #include <asm/tlbflush.h>
@@ -1585,6 +1586,13 @@ static bool try_to_unmap_one(struct foli pteval =ptep_clear_flush (vma, address, pvmw.pte); } +/* +* Now the pte is cleared. If this pte was uffd-wp armed, +* we may want to replace a none pte with a marker pte if +* it's file-backed, so we don't lose the tracking info. +*/ +pte_install_uffd_wp_if_needed (vma, address, pvmw.pte, pteval); +/* Set the dirty flag on the folio now the pte is gone. */ if (pte_dirty (pteval))folio_mark_dirty (folio);
_
Patches currently in -mm which might be from [email protected] are