linux-kselftest.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH v1 0/7] mm/ksm: break_ksm() cleanups and fixes
@ 2022-09-30 14:19 David Hildenbrand
  2022-09-30 14:19 ` [PATCH v1 1/7] selftests/vm: add test to measure MADV_UNMERGEABLE performance David Hildenbrand
                   ` (6 more replies)
  0 siblings, 7 replies; 24+ messages in thread
From: David Hildenbrand @ 2022-09-30 14:19 UTC (permalink / raw)
  To: linux-kernel
  Cc: linux-mm, linux-kselftest, David Hildenbrand, Andrew Morton,
	Shuah Khan, Hugh Dickins, Vlastimil Babka, Peter Xu,
	Andrea Arcangeli, Matthew Wilcox (Oracle),
	Jason Gunthorpe, John Hubbard

This series cleans up and fixes break_ksm(). In summary, we no longer
use fake write faults to break COW but instead FAULT_FLAG_UNSHARE. Further,
we move away from using follow_page() [that we can hopefully remove
completely at one point] and use new walk_page_range_vma() instead.

Fortunately, we can get rid of VM_FAULT_WRITE and FOLL_MIGRATION in common
code now.

Add a selftest to measure MADV_UNMERGEABLE performance. In my setup
(AMD Ryzen 9 3900X), running the KSM selftest to test unmerge performance
on 2 GiB (taskset 0x8 ./ksm_tests -D -s 2048), this results in a
performance degradation of ~8% -- 9% (old: ~5250 MiB/s, new: ~4800 MiB/s).
I don't think we particularly care for now, but it's good to be aware
of the implication.

Cc: Andrew Morton <akpm@linux-foundation.org>
Cc: Shuah Khan <shuah@kernel.org>
Cc: Hugh Dickins <hughd@google.com>
Cc: Vlastimil Babka <vbabka@suse.cz>
Cc: Peter Xu <peterx@redhat.com>
Cc: Andrea Arcangeli <aarcange@redhat.com>
Cc: "Matthew Wilcox (Oracle)" <willy@infradead.org>
Cc: Jason Gunthorpe <jgg@nvidia.com>
Cc: John Hubbard <jhubbard@nvidia.com>

David Hildenbrand (7):
  selftests/vm: add test to measure MADV_UNMERGEABLE performance
  mm/ksm: simplify break_ksm() to not rely on VM_FAULT_WRITE
  mm: remove VM_FAULT_WRITE
  mm/ksm: fix KSM COW breaking with userfaultfd-wp via
    FAULT_FLAG_UNSHARE
  mm/pagewalk: add walk_page_range_vma()
  mm/ksm: convert break_ksm() to use walk_page_range_vma()
  mm/gup: remove FOLL_MIGRATION

 include/linux/mm.h                     |   1 -
 include/linux/mm_types.h               |   3 -
 include/linux/pagewalk.h               |   3 +
 mm/gup.c                               |  55 ++-----------
 mm/huge_memory.c                       |   2 +-
 mm/ksm.c                               | 103 +++++++++++++++++++------
 mm/memory.c                            |   9 +--
 mm/pagewalk.c                          |  27 +++++++
 tools/testing/selftests/vm/ksm_tests.c |  76 +++++++++++++++++-
 9 files changed, 192 insertions(+), 87 deletions(-)

-- 
2.37.3


^ permalink raw reply	[flat|nested] 24+ messages in thread

end of thread, other threads:[~2022-10-21  9:13 UTC | newest]

Thread overview: 24+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2022-09-30 14:19 [PATCH v1 0/7] mm/ksm: break_ksm() cleanups and fixes David Hildenbrand
2022-09-30 14:19 ` [PATCH v1 1/7] selftests/vm: add test to measure MADV_UNMERGEABLE performance David Hildenbrand
2022-10-05 20:27   ` Peter Xu
2022-09-30 14:19 ` [PATCH v1 2/7] mm/ksm: simplify break_ksm() to not rely on VM_FAULT_WRITE David Hildenbrand
2022-10-05 20:29   ` Peter Xu
2022-09-30 14:19 ` [PATCH v1 3/7] mm: remove VM_FAULT_WRITE David Hildenbrand
2022-10-05 20:29   ` Peter Xu
2022-09-30 14:19 ` [PATCH v1 4/7] mm/ksm: fix KSM COW breaking with userfaultfd-wp via FAULT_FLAG_UNSHARE David Hildenbrand
2022-09-30 22:27   ` Andrew Morton
2022-10-01  8:13     ` David Hildenbrand
2022-10-05 20:35   ` Peter Xu
2022-10-06  9:29     ` David Hildenbrand
2022-10-06 19:04       ` Peter Xu
2022-10-20 10:05         ` David Hildenbrand
2022-09-30 14:19 ` [PATCH v1 5/7] mm/pagewalk: add walk_page_range_vma() David Hildenbrand
2022-10-05 20:42   ` Peter Xu
2022-10-06  9:35     ` David Hildenbrand
2022-09-30 14:19 ` [PATCH v1 6/7] mm/ksm: convert break_ksm() to use walk_page_range_vma() David Hildenbrand
2022-10-05 21:00   ` Peter Xu
2022-10-06  9:20     ` David Hildenbrand
2022-10-06 19:28       ` Peter Xu
2022-10-21  9:11         ` David Hildenbrand
2022-10-20  8:59   ` David Hildenbrand
2022-09-30 14:19 ` [PATCH v1 7/7] mm/gup: remove FOLL_MIGRATION David Hildenbrand

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).