Skip to content

Commit

Permalink
userfaultfd: selftest
Browse files Browse the repository at this point in the history
This test allocates two virtual areas and bounces the physical memory
across the two virtual areas using only userfaultfd.

Signed-off-by: Andrea Arcangeli <aarcange@redhat.com>
Cc: Pavel Emelyanov <xemul@parallels.com>
Cc: Dave Hansen <dave.hansen@intel.com>
Cc: Linus Torvalds <torvalds@linux-foundation.org>
Cc: Shuah Khan <shuah.kh@samsung.com>
Cc: Shuah Khan <shuahkh@osg.samsung.com>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
  • Loading branch information
aagit authored and torvalds committed Sep 4, 2015
1 parent 2c5b7e1 commit c47174f
Show file tree
Hide file tree
Showing 3 changed files with 650 additions and 0 deletions.
3 changes: 3 additions & 0 deletions tools/testing/selftests/vm/Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -8,10 +8,13 @@ BINARIES += hugetlbfstest
BINARIES += map_hugetlb
BINARIES += thuge-gen
BINARIES += transhuge-stress
BINARIES += userfaultfd

all: $(BINARIES)
%: %.c
$(CC) $(CFLAGS) -o $@ $^ -lrt
userfaultfd: userfaultfd.c
$(CC) $(CFLAGS) -O2 -o $@ $^ -lpthread

TEST_PROGS := run_vmtests
TEST_FILES := $(BINARIES)
Expand Down
11 changes: 11 additions & 0 deletions tools/testing/selftests/vm/run_vmtests
Original file line number Diff line number Diff line change
Expand Up @@ -86,6 +86,17 @@ else
echo "[PASS]"
fi

echo "--------------------"
echo "running userfaultfd"
echo "--------------------"
./userfaultfd 128 32
if [ $? -ne 0 ]; then
echo "[FAIL]"
exitcode=1
else
echo "[PASS]"
fi

#cleanup
umount $mnt
rm -rf $mnt
Expand Down

0 comments on commit c47174f

Please sign in to comment.