Skip to content

Commit

Permalink
selftests/mm: gup_longterm: new functional test for FOLL_LONGTERM
Browse files Browse the repository at this point in the history
Let's add a new test for checking whether GUP long-term page pinning works
as expected (R/O vs.  R/W, MAP_PRIVATE vs.  MAP_SHARED, GUP vs. 
GUP-fast).  Note that COW handling with long-term R/O pinning in private
mappings, and pinning of anonymous memory in general, is tested by the COW
selftest.  This test, therefore, focuses on page pinning in file mappings.

The most interesting case is probably the "local tmpfile" case, as that
will likely end up on a "real" filesystem such as ext4 or xfs, not on a
virtual one like tmpfs or hugetlb where any long-term page pinning is
always expected to succeed.

For now, only add tests that use the "/sys/kernel/debug/gup_test"
interface.  We'll add tests based on liburing separately next.

[akpm@linux-foundation.org: update .gitignore for gup_longterm, per Peter]
Link: https://lkml.kernel.org/r/20230519102723.185721-3-david@redhat.com
Signed-off-by: David Hildenbrand <david@redhat.com>
Reviewed-by: Lorenzo Stoakes <lstoakes@gmail.com>
Cc: Jan Kara <jack@suse.cz>
Cc: Jason Gunthorpe <jgg@nvidia.com>
Cc: Jens Axboe <axboe@kernel.dk>
Cc: John Hubbard <jhubbard@nvidia.com>
Cc: Peter Xu <peterx@redhat.com>
Cc: Shuah Khan <shuah@kernel.org>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
  • Loading branch information
David Hildenbrand authored and Andrew Morton committed Jun 9, 2023
1 parent 81b1e3f commit c879462
Show file tree
Hide file tree
Showing 4 changed files with 393 additions and 1 deletion.
1 change: 1 addition & 0 deletions tools/testing/selftests/mm/.gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -39,3 +39,4 @@ local_config.h
local_config.mk
ksm_functional_tests
mdwe_test
gup_longterm
3 changes: 3 additions & 0 deletions tools/testing/selftests/mm/Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,7 @@ LDLIBS = -lrt -lpthread

TEST_GEN_PROGS = cow
TEST_GEN_PROGS += compaction_test
TEST_GEN_PROGS += gup_longterm
TEST_GEN_PROGS += gup_test
TEST_GEN_PROGS += hmm-tests
TEST_GEN_PROGS += hugetlb-madvise
Expand Down Expand Up @@ -164,6 +165,8 @@ endif
# IOURING_EXTRA_LIBS may get set in local_config.mk, or it may be left empty.
$(OUTPUT)/cow: LDLIBS += $(IOURING_EXTRA_LIBS)

$(OUTPUT)/gup_longterm: LDLIBS += $(IOURING_EXTRA_LIBS)

$(OUTPUT)/mlock-random-test $(OUTPUT)/memfd_secret: LDLIBS += -lcap

$(OUTPUT)/ksm_tests: LDLIBS += -lnuma
Expand Down
Loading

0 comments on commit c879462

Please sign in to comment.