* [PATCH 0/3] vm hugetlb selftest cleanup
@ 2015-07-31 0:59 Mike Kravetz
2015-07-31 0:59 ` [PATCH 1/3] Reverted "selftests: add hugetlbfstest" Mike Kravetz
` (3 more replies)
0 siblings, 4 replies; 6+ messages in thread
From: Mike Kravetz @ 2015-07-31 0:59 UTC (permalink / raw)
To: linux-mm, linux-kernel, Andrew Morton, joern
Cc: Davidlohr Bueso, David Rientjes, Mike Kravetz
As a followup to discussions of hugetlbfs fallocate, this provides
cleanup the vm hugetlb selftests. Remove hugetlbfstest as it tests
functionality not present in the kernel. Emphasize that libhugetlbfs
test suite should be used for hugetlb regression testing.
Mike Kravetz (3):
Reverted "selftests: add hugetlbfstest"
selftests:vm: Point to libhugetlbfs for regression testing
Documentation: update libhugetlbfs location and use for testing
Documentation/vm/hugetlbpage.txt | 15 ++++--
tools/testing/selftests/vm/Makefile | 2 +-
tools/testing/selftests/vm/hugetlbfstest.c | 86 ------------------------------
tools/testing/selftests/vm/run_vmtests | 13 ++---
4 files changed, 15 insertions(+), 101 deletions(-)
delete mode 100644 tools/testing/selftests/vm/hugetlbfstest.c
--
2.1.0
^ permalink raw reply [flat|nested] 6+ messages in thread
* [PATCH 1/3] Reverted "selftests: add hugetlbfstest"
2015-07-31 0:59 [PATCH 0/3] vm hugetlb selftest cleanup Mike Kravetz
@ 2015-07-31 0:59 ` Mike Kravetz
2015-08-04 3:57 ` Mike Kravetz
2015-07-31 0:59 ` [PATCH 2/3] selftests:vm: Point to libhugetlbfs for regression testing Mike Kravetz
` (2 subsequent siblings)
3 siblings, 1 reply; 6+ messages in thread
From: Mike Kravetz @ 2015-07-31 0:59 UTC (permalink / raw)
To: linux-mm, linux-kernel, Andrew Morton, joern
Cc: Davidlohr Bueso, David Rientjes, Mike Kravetz
This manually reverts 7e50533d4b84289e4f01de56d6f98e9c64e2229e
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>
---
tools/testing/selftests/vm/Makefile | 2 +-
tools/testing/selftests/vm/hugetlbfstest.c | 86 ------------------------------
tools/testing/selftests/vm/run_vmtests | 11 ----
3 files changed, 1 insertion(+), 98 deletions(-)
delete mode 100644 tools/testing/selftests/vm/hugetlbfstest.c
diff --git a/tools/testing/selftests/vm/Makefile b/tools/testing/selftests/vm/Makefile
index f900e27..1b700f8 100644
--- a/tools/testing/selftests/vm/Makefile
+++ b/tools/testing/selftests/vm/Makefile
@@ -1,7 +1,7 @@
# Makefile for vm selftests
CFLAGS = -Wall
-BINARIES = hugepage-mmap hugepage-shm map_hugetlb thuge-gen hugetlbfstest
+BINARIES = hugepage-mmap hugepage-shm map_hugetlb thuge-gen
BINARIES += mlock2-tests
BINARIES += on-fault-limit
BINARIES += transhuge-stress
diff --git a/tools/testing/selftests/vm/hugetlbfstest.c b/tools/testing/selftests/vm/hugetlbfstest.c
deleted file mode 100644
index 02e1072..0000000
--- a/tools/testing/selftests/vm/hugetlbfstest.c
+++ /dev/null
@@ -1,86 +0,0 @@
-#define _GNU_SOURCE
-#include <assert.h>
-#include <fcntl.h>
-#include <stdio.h>
-#include <stdlib.h>
-#include <string.h>
-#include <sys/mman.h>
-#include <sys/stat.h>
-#include <sys/types.h>
-#include <unistd.h>
-
-typedef unsigned long long u64;
-
-static size_t length = 1 << 24;
-
-static u64 read_rss(void)
-{
- char buf[4096], *s = buf;
- int i, fd;
- u64 rss;
-
- fd = open("/proc/self/statm", O_RDONLY);
- assert(fd > 2);
- memset(buf, 0, sizeof(buf));
- read(fd, buf, sizeof(buf) - 1);
- for (i = 0; i < 1; i++)
- s = strchr(s, ' ') + 1;
- rss = strtoull(s, NULL, 10);
- return rss << 12; /* assumes 4k pagesize */
-}
-
-static void do_mmap(int fd, int extra_flags, int unmap)
-{
- int *p;
- int flags = MAP_PRIVATE | MAP_POPULATE | extra_flags;
- u64 before, after;
- int ret;
-
- before = read_rss();
- p = mmap(NULL, length, PROT_READ | PROT_WRITE, flags, fd, 0);
- assert(p != MAP_FAILED ||
- !"mmap returned an unexpected error");
- after = read_rss();
- assert(llabs(after - before - length) < 0x40000 ||
- !"rss didn't grow as expected");
- if (!unmap)
- return;
- ret = munmap(p, length);
- assert(!ret || !"munmap returned an unexpected error");
- after = read_rss();
- assert(llabs(after - before) < 0x40000 ||
- !"rss didn't shrink as expected");
-}
-
-static int open_file(const char *path)
-{
- int fd, err;
-
- unlink(path);
- fd = open(path, O_CREAT | O_RDWR | O_TRUNC | O_EXCL
- | O_LARGEFILE | O_CLOEXEC, 0600);
- assert(fd > 2);
- unlink(path);
- err = ftruncate(fd, length);
- assert(!err);
- return fd;
-}
-
-int main(void)
-{
- int hugefd, fd;
-
- fd = open_file("/dev/shm/hugetlbhog");
- hugefd = open_file("/hugepages/hugetlbhog");
-
- system("echo 100 > /proc/sys/vm/nr_hugepages");
- do_mmap(-1, MAP_ANONYMOUS, 1);
- do_mmap(fd, 0, 1);
- do_mmap(-1, MAP_ANONYMOUS | MAP_HUGETLB, 1);
- do_mmap(hugefd, 0, 1);
- do_mmap(hugefd, MAP_HUGETLB, 1);
- /* Leak the last one to test do_exit() */
- do_mmap(-1, MAP_ANONYMOUS | MAP_HUGETLB, 0);
- printf("oll korrekt.\n");
- return 0;
-}
diff --git a/tools/testing/selftests/vm/run_vmtests b/tools/testing/selftests/vm/run_vmtests
index cc5a973..9837a3f 100755
--- a/tools/testing/selftests/vm/run_vmtests
+++ b/tools/testing/selftests/vm/run_vmtests
@@ -76,17 +76,6 @@ else
fi
echo "--------------------"
-echo "running hugetlbfstest"
-echo "--------------------"
-./hugetlbfstest
-if [ $? -ne 0 ]; then
- echo "[FAIL]"
- exitcode=1
-else
- echo "[PASS]"
-fi
-
-echo "--------------------"
echo "running userfaultfd"
echo "--------------------"
./userfaultfd 128 32
--
2.1.0
^ permalink raw reply related [flat|nested] 6+ messages in thread
* [PATCH 2/3] selftests:vm: Point to libhugetlbfs for regression testing
2015-07-31 0:59 [PATCH 0/3] vm hugetlb selftest cleanup Mike Kravetz
2015-07-31 0:59 ` [PATCH 1/3] Reverted "selftests: add hugetlbfstest" Mike Kravetz
@ 2015-07-31 0:59 ` Mike Kravetz
2015-07-31 0:59 ` [PATCH 3/3] Documentation: update libhugetlbfs location and use for testing Mike Kravetz
2015-08-04 3:04 ` [PATCH 0/3] vm hugetlb selftest cleanup Naoya Horiguchi
3 siblings, 0 replies; 6+ messages in thread
From: Mike Kravetz @ 2015-07-31 0:59 UTC (permalink / raw)
To: linux-mm, linux-kernel, Andrew Morton, joern
Cc: Davidlohr Bueso, David Rientjes, Mike Kravetz
The hugetlb selftests provide minimal coverage. Have run script
point people at libhugetlbfs for better regression testing.
Signed-off-by: Mike Kravetz <mike.kravetz@oracle.com>
---
tools/testing/selftests/vm/run_vmtests | 4 ++++
1 file changed, 4 insertions(+)
diff --git a/tools/testing/selftests/vm/run_vmtests b/tools/testing/selftests/vm/run_vmtests
index 9837a3f..9e5df58 100755
--- a/tools/testing/selftests/vm/run_vmtests
+++ b/tools/testing/selftests/vm/run_vmtests
@@ -75,6 +75,10 @@ else
echo "[PASS]"
fi
+echo "NOTE: The above hugetlb tests provide minimal coverage. Use"
+echo " https://github.com/libhugetlbfs/libhugetlbfs.git for"
+echo " hugetlb regression testing."
+
echo "--------------------"
echo "running userfaultfd"
echo "--------------------"
--
2.1.0
^ permalink raw reply related [flat|nested] 6+ messages in thread
* [PATCH 3/3] Documentation: update libhugetlbfs location and use for testing
2015-07-31 0:59 [PATCH 0/3] vm hugetlb selftest cleanup Mike Kravetz
2015-07-31 0:59 ` [PATCH 1/3] Reverted "selftests: add hugetlbfstest" Mike Kravetz
2015-07-31 0:59 ` [PATCH 2/3] selftests:vm: Point to libhugetlbfs for regression testing Mike Kravetz
@ 2015-07-31 0:59 ` Mike Kravetz
2015-08-04 3:04 ` [PATCH 0/3] vm hugetlb selftest cleanup Naoya Horiguchi
3 siblings, 0 replies; 6+ messages in thread
From: Mike Kravetz @ 2015-07-31 0:59 UTC (permalink / raw)
To: linux-mm, linux-kernel, Andrew Morton, joern
Cc: Davidlohr Bueso, David Rientjes, Mike Kravetz
The URL for libhugetlbfs has changed. Also, put a stronger emphasis
on using libgugetlbfs for hugetlb regression testing.
Signed-off-by: Mike Kravetz <mike.kravetz@oracle.com>
---
Documentation/vm/hugetlbpage.txt | 15 +++++++++++----
1 file changed, 11 insertions(+), 4 deletions(-)
diff --git a/Documentation/vm/hugetlbpage.txt b/Documentation/vm/hugetlbpage.txt
index 030977f..54dd9b9 100644
--- a/Documentation/vm/hugetlbpage.txt
+++ b/Documentation/vm/hugetlbpage.txt
@@ -329,7 +329,14 @@ Examples
3) hugepage-mmap: see tools/testing/selftests/vm/hugepage-mmap.c
-4) The libhugetlbfs (http://libhugetlbfs.sourceforge.net) library provides a
- wide range of userspace tools to help with huge page usability, environment
- setup, and control. Furthermore it provides useful test cases that should be
- used when modifying code to ensure no regressions are introduced.
+4) The libhugetlbfs (https://github.com/libhugetlbfs/libhugetlbfs) library
+ provides a wide range of userspace tools to help with huge page usability,
+ environment setup, and control.
+
+Kernel development regression testing
+=====================================
+
+The most complete set of hugetlb tests are in the libhugetlbfs repository.
+If you modify any hugetlb related code, use the libhugetlbfs test suite
+to check for regressions. In addition, if you add any new hugetlb
+functionality, please add appropriate tests to libhugetlbfs.
--
2.1.0
^ permalink raw reply related [flat|nested] 6+ messages in thread
* Re: [PATCH 0/3] vm hugetlb selftest cleanup
2015-07-31 0:59 [PATCH 0/3] vm hugetlb selftest cleanup Mike Kravetz
` (2 preceding siblings ...)
2015-07-31 0:59 ` [PATCH 3/3] Documentation: update libhugetlbfs location and use for testing Mike Kravetz
@ 2015-08-04 3:04 ` Naoya Horiguchi
3 siblings, 0 replies; 6+ messages in thread
From: Naoya Horiguchi @ 2015-08-04 3:04 UTC (permalink / raw)
To: Mike Kravetz
Cc: linux-mm, linux-kernel, Andrew Morton, joern, Davidlohr Bueso,
David Rientjes
On Thu, Jul 30, 2015 at 05:59:50PM -0700, Mike Kravetz wrote:
> As a followup to discussions of hugetlbfs fallocate, this provides
> cleanup the vm hugetlb selftests. Remove hugetlbfstest as it tests
> functionality not present in the kernel. Emphasize that libhugetlbfs
> test suite should be used for hugetlb regression testing.
>
> Mike Kravetz (3):
> Reverted "selftests: add hugetlbfstest"
> selftests:vm: Point to libhugetlbfs for regression testing
> Documentation: update libhugetlbfs location and use for testing
It seems that patch 1 conflicts with commit bd67d5c15cc1 ("Test compaction
of mlocked memory"), but the resolution is trivial, so for the series ...
Acked-by: Naoya Horiguchi <n-horiguchi@ah.jp.nec.com>
Thanks!
^ permalink raw reply [flat|nested] 6+ messages in thread
* Re: [PATCH 1/3] Reverted "selftests: add hugetlbfstest"
2015-07-31 0:59 ` [PATCH 1/3] Reverted "selftests: add hugetlbfstest" Mike Kravetz
@ 2015-08-04 3:57 ` Mike Kravetz
0 siblings, 0 replies; 6+ messages in thread
From: Mike Kravetz @ 2015-08-04 3:57 UTC (permalink / raw)
To: linux-mm, linux-kernel, Andrew Morton, joern
Cc: Davidlohr Bueso, David Rientjes, Naoya Horiguchi
Rebased as suggested by Naoya Horiguch
This manually reverts 7e50533d4b84289e4f01de56d6f98e9c64e2229e
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>
---
tools/testing/selftests/vm/Makefile | 1 -
tools/testing/selftests/vm/hugetlbfstest.c | 86
------------------------------
tools/testing/selftests/vm/run_vmtests | 11 ----
3 files changed, 98 deletions(-)
delete mode 100644 tools/testing/selftests/vm/hugetlbfstest.c
diff --git a/tools/testing/selftests/vm/Makefile
b/tools/testing/selftests/vm/Makefile
index 2da6608..bb888c6 100644
--- a/tools/testing/selftests/vm/Makefile
+++ b/tools/testing/selftests/vm/Makefile
@@ -4,7 +4,6 @@ CFLAGS = -Wall
BINARIES = compaction_test
BINARIES += hugepage-mmap
BINARIES += hugepage-shm
-BINARIES += hugetlbfstest
BINARIES += map_hugetlb
BINARIES += mlock2-tests
BINARIES += on-fault-limit
diff --git a/tools/testing/selftests/vm/hugetlbfstest.c
b/tools/testing/selftests/vm/hugetlbfstest.c
deleted file mode 100644
index 02e1072..0000000
--- a/tools/testing/selftests/vm/hugetlbfstest.c
+++ /dev/null
@@ -1,86 +0,0 @@
-#define _GNU_SOURCE
-#include <assert.h>
-#include <fcntl.h>
-#include <stdio.h>
-#include <stdlib.h>
-#include <string.h>
-#include <sys/mman.h>
-#include <sys/stat.h>
-#include <sys/types.h>
-#include <unistd.h>
-
-typedef unsigned long long u64;
-
-static size_t length = 1 << 24;
-
-static u64 read_rss(void)
-{
- char buf[4096], *s = buf;
- int i, fd;
- u64 rss;
-
- fd = open("/proc/self/statm", O_RDONLY);
- assert(fd > 2);
- memset(buf, 0, sizeof(buf));
- read(fd, buf, sizeof(buf) - 1);
- for (i = 0; i < 1; i++)
- s = strchr(s, ' ') + 1;
- rss = strtoull(s, NULL, 10);
- return rss << 12; /* assumes 4k pagesize */
-}
-
-static void do_mmap(int fd, int extra_flags, int unmap)
-{
- int *p;
- int flags = MAP_PRIVATE | MAP_POPULATE | extra_flags;
- u64 before, after;
- int ret;
-
- before = read_rss();
- p = mmap(NULL, length, PROT_READ | PROT_WRITE, flags, fd, 0);
- assert(p != MAP_FAILED ||
- !"mmap returned an unexpected error");
- after = read_rss();
- assert(llabs(after - before - length) < 0x40000 ||
- !"rss didn't grow as expected");
- if (!unmap)
- return;
- ret = munmap(p, length);
- assert(!ret || !"munmap returned an unexpected error");
- after = read_rss();
- assert(llabs(after - before) < 0x40000 ||
- !"rss didn't shrink as expected");
-}
-
-static int open_file(const char *path)
-{
- int fd, err;
-
- unlink(path);
- fd = open(path, O_CREAT | O_RDWR | O_TRUNC | O_EXCL
- | O_LARGEFILE | O_CLOEXEC, 0600);
- assert(fd > 2);
- unlink(path);
- err = ftruncate(fd, length);
- assert(!err);
- return fd;
-}
-
-int main(void)
-{
- int hugefd, fd;
-
- fd = open_file("/dev/shm/hugetlbhog");
- hugefd = open_file("/hugepages/hugetlbhog");
-
- system("echo 100 > /proc/sys/vm/nr_hugepages");
- do_mmap(-1, MAP_ANONYMOUS, 1);
- do_mmap(fd, 0, 1);
- do_mmap(-1, MAP_ANONYMOUS | MAP_HUGETLB, 1);
- do_mmap(hugefd, 0, 1);
- do_mmap(hugefd, MAP_HUGETLB, 1);
- /* Leak the last one to test do_exit() */
- do_mmap(-1, MAP_ANONYMOUS | MAP_HUGETLB, 0);
- printf("oll korrekt.\n");
- return 0;
-}
diff --git a/tools/testing/selftests/vm/run_vmtests
b/tools/testing/selftests/vm/run_vmtests
index 231174a..b7ae2b6 100755
--- a/tools/testing/selftests/vm/run_vmtests
+++ b/tools/testing/selftests/vm/run_vmtests
@@ -76,17 +76,6 @@ else
fi
echo "--------------------"
-echo "running hugetlbfstest"
-echo "--------------------"
-./hugetlbfstest
-if [ $? -ne 0 ]; then
- echo "[FAIL]"
- exitcode=1
-else
- echo "[PASS]"
-fi
-
-echo "--------------------"
echo "running userfaultfd"
echo "--------------------"
./userfaultfd 128 32
--
2.4.3
^ permalink raw reply related [flat|nested] 6+ messages in thread
end of thread, other threads:[~2015-08-04 3:57 UTC | newest]
Thread overview: 6+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2015-07-31 0:59 [PATCH 0/3] vm hugetlb selftest cleanup Mike Kravetz
2015-07-31 0:59 ` [PATCH 1/3] Reverted "selftests: add hugetlbfstest" Mike Kravetz
2015-08-04 3:57 ` Mike Kravetz
2015-07-31 0:59 ` [PATCH 2/3] selftests:vm: Point to libhugetlbfs for regression testing Mike Kravetz
2015-07-31 0:59 ` [PATCH 3/3] Documentation: update libhugetlbfs location and use for testing Mike Kravetz
2015-08-04 3:04 ` [PATCH 0/3] vm hugetlb selftest cleanup Naoya Horiguchi
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).