Skip to content

Commit

Permalink
selftests/vm: anon_cow: test COW handling of anonymous memory
Browse files Browse the repository at this point in the history
Patch series "selftests/vm: test COW handling of anonymous memory".

This is my current set of tests for testing COW handling of anonymous
memory, especially when interacting with GUP.  I developed these tests
while working on PageAnonExclusive and managed to clean them up just now.

On current upstream Linux, all tests pass except the hugetlb tests that
rely on vmsplice -- these tests should pass as soon as vmsplice properly
uses FOLL_PIN instead of FOLL_GET.

I'm working on additional tests for COW handling in private mappings,
focusing on long-term R/O pinning e.g., of the shared zeropage, pagecache
pages and KSM pages.  These tests, however, will go into a different file.
So this is everything I have regarding tests for anonymous memory.


This patch (of 7):

Let's start adding tests for our COW handling of anonymous memory.  We'll
focus on basic tests that we can achieve without additional libraries or
gup_test extensions.

We'll add THP and hugetlb tests separately.

[[email protected]: s/size_t/ssize_t/ on `cur', `total', `transferred';]
  Link: https://lkml.kernel.org/r/[email protected]
Link: https://lkml.kernel.org/r/[email protected]
Link: https://lkml.kernel.org/r/[email protected]
Signed-off-by: David Hildenbrand <[email protected]>
Cc: Andrea Arcangeli <[email protected]>
Cc: Christoph von Recklinghausen <[email protected]>
Cc: Don Dutile <[email protected]>
Cc: Jason Gunthorpe <[email protected]>
Cc: John Hubbard <[email protected]>
Cc: Mike Rapoport <[email protected]>
Cc: Nadav Amit <[email protected]>
Cc: Peter Xu <[email protected]>
Cc: Shuah Khan <[email protected]>
Cc: Vlastimil Babka <[email protected]>
Signed-off-by: Andrew Morton <[email protected]>
  • Loading branch information
davidhildenbrand authored and akpm00 committed Nov 9, 2022
1 parent b2c5bd4 commit 69c66ad
Show file tree
Hide file tree
Showing 6 changed files with 416 additions and 1 deletion.
1 change: 1 addition & 0 deletions tools/testing/selftests/vm/.gitignore
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
# SPDX-License-Identifier: GPL-2.0-only
anon_cow
hugepage-mmap
hugepage-mremap
hugepage-shm
Expand Down
4 changes: 3 additions & 1 deletion tools/testing/selftests/vm/Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,8 @@ MAKEFLAGS += --no-builtin-rules

CFLAGS = -Wall -I $(top_srcdir) -I $(top_srcdir)/usr/include $(EXTRA_CFLAGS) $(KHDR_INCLUDES)
LDLIBS = -lrt -lpthread
TEST_GEN_FILES = compaction_test
TEST_GEN_FILES = anon_cow
TEST_GEN_FILES += compaction_test
TEST_GEN_FILES += gup_test
TEST_GEN_FILES += hmm-tests
TEST_GEN_FILES += hugetlb-madvise
Expand Down Expand Up @@ -95,6 +96,7 @@ TEST_FILES += va_128TBswitch.sh

include ../lib.mk

$(OUTPUT)/anon_cow: vm_util.c
$(OUTPUT)/khugepaged: vm_util.c
$(OUTPUT)/madv_populate: vm_util.c
$(OUTPUT)/soft-dirty: vm_util.c
Expand Down
Loading

0 comments on commit 69c66ad

Please sign in to comment.