diff options
author | Mike Kravetz <mike.kravetz@oracle.com> | 2015-09-08 18:02:52 -0400 |
---|---|---|
committer | Linus Torvalds <torvalds@linux-foundation.org> | 2015-09-08 18:35:28 -0400 |
commit | 243db5351aae5e6756fb610d41431a30d44b56a6 (patch) | |
tree | ed42d2fb09e39ad54e3a4231f8dca2767e18ef22 /tools | |
parent | 9fcd6d2e052eef525e94a9ae58dbe7ed4df4f5a7 (diff) |
Revert "selftests: add hugetlbfstest"
This manually reverts 7e50533d4b842 ("selftests: add hugetlbfstest").
The hugetlbfstest test depends on hugetlb pages being counted in a
task's rss. This functionality is not in the kernel, so the test will
always fail. Remove test to avoid confusion.
Signed-off-by: Mike Kravetz <mike.kravetz@oracle.com>
Acked-by: Naoya Horiguchi <n-horiguchi@ah.jp.nec.com>
Cc: Joern Engel <joern@logfs.org>
Cc: Davidlohr Bueso <dave@stgolabs.net>
Cc: David Rientjes <rientjes@google.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>
Diffstat (limited to 'tools')
-rw-r--r-- | tools/testing/selftests/vm/Makefile | 1 | ||||
-rw-r--r-- | tools/testing/selftests/vm/hugetlbfstest.c | 86 | ||||
-rwxr-xr-x | tools/testing/selftests/vm/run_vmtests | 11 |
3 files changed, 0 insertions, 98 deletions
diff --git a/tools/testing/selftests/vm/Makefile b/tools/testing/selftests/vm/Makefile index 0d6854744b37..d36fab7d8ebd 100644 --- a/tools/testing/selftests/vm/Makefile +++ b/tools/testing/selftests/vm/Makefile | |||
@@ -4,7 +4,6 @@ CFLAGS = -Wall | |||
4 | BINARIES = compaction_test | 4 | BINARIES = compaction_test |
5 | BINARIES += hugepage-mmap | 5 | BINARIES += hugepage-mmap |
6 | BINARIES += hugepage-shm | 6 | BINARIES += hugepage-shm |
7 | BINARIES += hugetlbfstest | ||
8 | BINARIES += map_hugetlb | 7 | BINARIES += map_hugetlb |
9 | BINARIES += thuge-gen | 8 | BINARIES += thuge-gen |
10 | BINARIES += transhuge-stress | 9 | BINARIES += transhuge-stress |
diff --git a/tools/testing/selftests/vm/hugetlbfstest.c b/tools/testing/selftests/vm/hugetlbfstest.c deleted file mode 100644 index 02e1072ec187..000000000000 --- a/tools/testing/selftests/vm/hugetlbfstest.c +++ /dev/null | |||
@@ -1,86 +0,0 @@ | |||
1 | #define _GNU_SOURCE | ||
2 | #include <assert.h> | ||
3 | #include <fcntl.h> | ||
4 | #include <stdio.h> | ||
5 | #include <stdlib.h> | ||
6 | #include <string.h> | ||
7 | #include <sys/mman.h> | ||
8 | #include <sys/stat.h> | ||
9 | #include <sys/types.h> | ||
10 | #include <unistd.h> | ||
11 | |||
12 | typedef unsigned long long u64; | ||
13 | |||
14 | static size_t length = 1 << 24; | ||
15 | |||
16 | static u64 read_rss(void) | ||
17 | { | ||
18 | char buf[4096], *s = buf; | ||
19 | int i, fd; | ||
20 | u64 rss; | ||
21 | |||
22 | fd = open("/proc/self/statm", O_RDONLY); | ||
23 | assert(fd > 2); | ||
24 | memset(buf, 0, sizeof(buf)); | ||
25 | read(fd, buf, sizeof(buf) - 1); | ||
26 | for (i = 0; i < 1; i++) | ||
27 | s = strchr(s, ' ') + 1; | ||
28 | rss = strtoull(s, NULL, 10); | ||
29 | return rss << 12; /* assumes 4k pagesize */ | ||
30 | } | ||
31 | |||
32 | static void do_mmap(int fd, int extra_flags, int unmap) | ||
33 | { | ||
34 | int *p; | ||
35 | int flags = MAP_PRIVATE | MAP_POPULATE | extra_flags; | ||
36 | u64 before, after; | ||
37 | int ret; | ||
38 | |||
39 | before = read_rss(); | ||
40 | p = mmap(NULL, length, PROT_READ | PROT_WRITE, flags, fd, 0); | ||
41 | assert(p != MAP_FAILED || | ||
42 | !"mmap returned an unexpected error"); | ||
43 | after = read_rss(); | ||
44 | assert(llabs(after - before - length) < 0x40000 || | ||
45 | !"rss didn't grow as expected"); | ||
46 | if (!unmap) | ||
47 | return; | ||
48 | ret = munmap(p, length); | ||
49 | assert(!ret || !"munmap returned an unexpected error"); | ||
50 | after = read_rss(); | ||
51 | assert(llabs(after - before) < 0x40000 || | ||
52 | !"rss didn't shrink as expected"); | ||
53 | } | ||
54 | |||
55 | static int open_file(const char *path) | ||
56 | { | ||
57 | int fd, err; | ||
58 | |||
59 | unlink(path); | ||
60 | fd = open(path, O_CREAT | O_RDWR | O_TRUNC | O_EXCL | ||
61 | | O_LARGEFILE | O_CLOEXEC, 0600); | ||
62 | assert(fd > 2); | ||
63 | unlink(path); | ||
64 | err = ftruncate(fd, length); | ||
65 | assert(!err); | ||
66 | return fd; | ||
67 | } | ||
68 | |||
69 | int main(void) | ||
70 | { | ||
71 | int hugefd, fd; | ||
72 | |||
73 | fd = open_file("/dev/shm/hugetlbhog"); | ||
74 | hugefd = open_file("/hugepages/hugetlbhog"); | ||
75 | |||
76 | system("echo 100 > /proc/sys/vm/nr_hugepages"); | ||
77 | do_mmap(-1, MAP_ANONYMOUS, 1); | ||
78 | do_mmap(fd, 0, 1); | ||
79 | do_mmap(-1, MAP_ANONYMOUS | MAP_HUGETLB, 1); | ||
80 | do_mmap(hugefd, 0, 1); | ||
81 | do_mmap(hugefd, MAP_HUGETLB, 1); | ||
82 | /* Leak the last one to test do_exit() */ | ||
83 | do_mmap(-1, MAP_ANONYMOUS | MAP_HUGETLB, 0); | ||
84 | printf("oll korrekt.\n"); | ||
85 | return 0; | ||
86 | } | ||
diff --git a/tools/testing/selftests/vm/run_vmtests b/tools/testing/selftests/vm/run_vmtests index 831adeb5fc55..d891d6e326f4 100755 --- a/tools/testing/selftests/vm/run_vmtests +++ b/tools/testing/selftests/vm/run_vmtests | |||
@@ -76,17 +76,6 @@ else | |||
76 | fi | 76 | fi |
77 | 77 | ||
78 | echo "--------------------" | 78 | echo "--------------------" |
79 | echo "running hugetlbfstest" | ||
80 | echo "--------------------" | ||
81 | ./hugetlbfstest | ||
82 | if [ $? -ne 0 ]; then | ||
83 | echo "[FAIL]" | ||
84 | exitcode=1 | ||
85 | else | ||
86 | echo "[PASS]" | ||
87 | fi | ||
88 | |||
89 | echo "--------------------" | ||
90 | echo "running userfaultfd" | 79 | echo "running userfaultfd" |
91 | echo "--------------------" | 80 | echo "--------------------" |
92 | ./userfaultfd 128 32 | 81 | ./userfaultfd 128 32 |