Merge emailed patches from Peter Xu: "This is a small series that I picked up from Linus's suggestion to simplify cow handling (and also make it more strict) by checking against page refcounts rather than mapcounts. This makes uffd-wp work again (verified by running upmapsort)" Note: this is horrendously bad timing, and making this kind of fundamental vm change after -rc3 is not at all how things should work. The saving grace is that it really is a a nice simplification: 8 files changed, 29 insertions(+), 120 deletions(-) The reason for the bad timing is that it turns out that commit 17839856fd58 ("gup: document and work around 'COW can break either way' issue" broke not just UFFD functionality (as Peter noticed), but Mikulas Patocka also reports that it caused issues for strace when running in a DAX environment with ext4 on a persistent memory setup. And we can't just revert that commit without re-introducing the original issue that is a potential security hole, so making COW stricter (and in the process much simpler) is a step to then undoing the forced COW that broke other uses. Link: https://lore.kernel.org/lkml/alpine.LRH.2.02.2009031328040.6929@file01.intranet.prod.int.rdu2.redhat.com/ * emailed patches from Peter Xu <peterx@redhat.com>: mm: Add PGREUSE counter mm/gup: Remove enfornced COW mechanism mm/ksm: Remove reuse_ksm_page() mm: do_wp_page() simplification
Showing the changes to include/linux (2 of 8 files). Show all
Unified · Split
| @@ -53,8 +53,6 @@ struct page *ksm_might_need_to_copy(struct page *page, · 52 unmodified lines | |||
| 53 | 53 | ||
| 54 | void rmap_walk_ksm(struct page *page, struct rmap_walk_control *rwc); | 54 | void rmap_walk_ksm(struct page *page, struct rmap_walk_control *rwc); |
| 55 | void ksm_migrate_page(struct page *newpage, struct page *oldpage); | 55 | void ksm_migrate_page(struct page *newpage, struct page *oldpage); |
| 56 | bool reuse_ksm_page(struct page *page, | ||
| 57 | struct vm_area_struct *vma, unsigned long address); | ||
| 58 | 56 | ||
| 59 | #else /* !CONFIG_KSM */ | 57 | #else /* !CONFIG_KSM */ |
| 60 | 58 | ||
| @@ -88,11 +86,6 @@ static inline void rmap_walk_ksm(struct page *page, · 27 unmodified lines | |||
| 88 | static inline void ksm_migrate_page(struct page *newpage, struct page *oldpage) | 86 | static inline void ksm_migrate_page(struct page *newpage, struct page *oldpage) |
| 89 | { | 87 | { |
| 90 | } | 88 | } |
| 91 | static inline bool reuse_ksm_page(struct page *page, | ||
| 92 | struct vm_area_struct *vma, unsigned long address) | ||
| 93 | { | ||
| 94 | return false; | ||
| 95 | } | ||
| 96 | #endif /* CONFIG_MMU */ | 89 | #endif /* CONFIG_MMU */ |
| 97 | #endif /* !CONFIG_KSM */ | 90 | #endif /* !CONFIG_KSM */ |
| 98 | 91 | ||
| @@ -30,6 +30,7 @@ enum vm_event_item { PGPGIN, PGPGOUT, PSWPIN, PSWPOUT, · 29 unmodified lines | |||
| 30 | PGFAULT, PGMAJFAULT, | 30 | PGFAULT, PGMAJFAULT, |
| 31 | PGLAZYFREED, | 31 | PGLAZYFREED, |
| 32 | PGREFILL, | 32 | PGREFILL, |
| 33 | PGREUSE, | ||
| 33 | PGSTEAL_KSWAPD, | 34 | PGSTEAL_KSWAPD, |
| 34 | PGSTEAL_DIRECT, | 35 | PGSTEAL_DIRECT, |
| 35 | PGSCAN_KSWAPD, | 36 | PGSCAN_KSWAPD, |