Skip to content

mm: Simplfy cow handling

Peter Xu linux-mm lkml 1 version In review

Get series with b4
b4 am [email protected]

Versions newest first

  1. v1 Latest4 patches 85 repliesIn review

Patches in v1 No applies recorded yet

#Subject and filesSizeRepliesApplied
1/4mm: Trial do_wp_page() simplificationmm/memory.c+17 -4276 replies
2/4mm/ksm: Remove reuse_ksm_page()include/linux/ksm.h mm/ksm.c+0 -320 replies
3/4mm/gup: Remove enfornced COW mechanismdrivers/gpu/drm/i915/gem/i915_gem_userptr.c mm/gup.c mm/huge_memory.c+9 -463 replies
4/4mm: Add PGREUSE counterinclude/linux/vm_event_item.h mm/memory.c mm/vmstat.c+3 -02 replies

Reviews trailers per patch

No Reviewed-by, Acked-by or Tested-by trailers for v1 yet.

Read the v1 thread

Cover letter [PATCH 0/4] mm: Simplfy cow handling

This is a small series that I picked up from Linus's suggestion [0] to simplify cow handling (and also more strict) by checking against page refcounts rather than mapcounts.

I'm CCing the author and reviewer of commit 52d1e606ee73 on ksm ("mm: reuse only-pte-mapped KSM page in do_wp_page()", 2019-03-05). Please shoot if there's any reason to keep the logic, or it'll be removed in this series. For more information, please refer to [3,4].

The new mm counter in the last patch can be seen as RFC, depending on whether anyone dislikes it... I used it majorly for observing the page reuses, so it is kind of optional.

Two tests I did:

- Run a busy loop dirty program [1] that uses 6G of memory, restrict to 1G RAM + 5G swap (cgroup). A few hours later, all things still look good. Make sure to observe (still massive) correct page reuses using the new counter using the last patch, probably when swapping in.

- Run umapsort [2] to make sure uffd-wp will work again after applying this

    series upon master 5.9-rc1 (5.9-rc1 is broken).

In all cases, I must confess it's quite pleased to post a series with diffstat like this... Hopefully this won't break anyone but only to make everything better.

Please review, thanks.

[0] https://lore.kernel.org/lkml/CAHk-=wjn90-=s6MBerxTuP=-FVEZtR-LpoH9eenEQ3A-QfKTZw@mail.gmail.com
[1] https://github.com/xzpeter/clibs/blob/master/bsd/mig_mon/mig_mon.c
[2] https://github.com/LLNL/umap-apps/blob/develop/src/umapsort/umapsort.cpp
[3] https://lore.kernel.org/lkml/CAHk-=wh0syDtNzt9jGyHRV0r1pVX5gkdJWdenwmvy=dq0AL5mA@mail.gmail.com
[4] https://lore.kernel.org/lkml/CAHk-=wj5Oyg0LeAxSw_vizerm=sLd=sHfcVecZMKPZn6kNbbXA@mail.gmail.com

Linus Torvalds (1):
mm: Trial do_wp_page() simplification

Peter Xu (3):
mm/ksm: Remove reuse_ksm_page()
mm/gup: Remove enfornced COW mechanism
mm: Add PGREUSE counter

 drivers/gpu/drm/i915/gem/i915_gem_userptr.c |  8 ---
 include/linux/ksm.h                         |  7 ---
 include/linux/vm_event_item.h               |  1 +
 mm/gup.c                                    | 40 ++------------
 mm/huge_memory.c                            |  7 +--
 mm/ksm.c                                    | 25 ---------
 mm/memory.c                                 | 60 +++++++--------------
 mm/vmstat.c                                 |  1 +
 8 files changed, 29 insertions(+), 120 deletions(-)
Signature · 1 line
2.26.2