Blame SOURCES/0018-mmap-tests-Run-tests-with-correct-huge-page-count.patch

fc9b0e
From d228c0e688e7a0771d30457d21b38d745cea63bf Mon Sep 17 00:00:00 2001
fc9b0e
Message-Id: <d228c0e688e7a0771d30457d21b38d745cea63bf.1566225007.git.aquini@redhat.com>
fc9b0e
In-Reply-To: <d42f467a923dfc09309acb7a83b42e3285fbd8f4.1566225007.git.aquini@redhat.com>
fc9b0e
References: <d42f467a923dfc09309acb7a83b42e3285fbd8f4.1566225007.git.aquini@redhat.com>
fc9b0e
From: Sandipan Das <sandipan@linux.ibm.com>
fc9b0e
Date: Fri, 16 Aug 2019 11:45:08 +0530
fc9b0e
Subject: [RHEL7 PATCH 18/31] mmap: tests: Run tests with correct huge page
fc9b0e
 count
fc9b0e
fc9b0e
This ensures that the mmap-gettest and mmap-cow tests are run
fc9b0e
with the correct count of free huge pages. Previously, it was
fc9b0e
always using the free page count for the default huge page size
fc9b0e
for all huge page sizes. Since these counts can differ, trying
fc9b0e
to get more pages via mmap() than what is available in the pool
fc9b0e
can make these tests fail.
fc9b0e
fc9b0e
Signed-off-by: Sandipan Das <sandipan@linux.ibm.com>
fc9b0e
Signed-off-by: Eric B Munson <eric@munsonfam.org>
fc9b0e
Signed-off-by: Rafael Aquini <aquini@redhat.com>
fc9b0e
---
fc9b0e
 tests/run_tests.py | 13 +++++++++----
fc9b0e
 1 file changed, 9 insertions(+), 4 deletions(-)
fc9b0e
fc9b0e
diff --git a/tests/run_tests.py b/tests/run_tests.py
fc9b0e
index f19024f..b132da2 100755
fc9b0e
--- a/tests/run_tests.py
fc9b0e
+++ b/tests/run_tests.py
fc9b0e
@@ -697,14 +697,19 @@ def stress_tests():
fc9b0e
     # Don't update NRPAGES every time like above because we want to catch the
fc9b0e
     # failures that happen when the kernel doesn't release all of the huge pages
fc9b0e
     # after a stress test terminates
fc9b0e
-    (rc, nr_pages) = free_hpages()
fc9b0e
+    nr_pages = {p: free_hpages(p)[1] for p in pagesizes}
fc9b0e
 
fc9b0e
-    do_test(("mmap-gettest", repr(iterations), repr(nr_pages)))
fc9b0e
+    for p in pagesizes:
fc9b0e
+        cmd = ("mmap-gettest", repr(iterations), repr(nr_pages[p]))
fc9b0e
+        do_test_with_pagesize(p, cmd)
fc9b0e
 
fc9b0e
-    # mmap-cow needs a hugepages for each thread plus one extra
fc9b0e
-    do_test(("mmap-cow", repr(nr_pages-1), repr(nr_pages)))
fc9b0e
+    for p in pagesizes:
fc9b0e
+        # mmap-cow needs a hugepage for each thread plus one extra
fc9b0e
+        cmd = ("mmap-cow", repr(nr_pages[p]-1), repr(nr_pages[p]))
fc9b0e
+        do_test_with_pagesize(p, cmd)
fc9b0e
 
fc9b0e
     (rc, tot_pages) = total_hpages()
fc9b0e
+    nr_pages = nr_pages[system_default_hpage_size]
fc9b0e
     limit = system_default_hpage_size * tot_pages
fc9b0e
     threads = 10	# Number of threads for shm-fork
fc9b0e
 
fc9b0e
-- 
fc9b0e
1.8.3.1
fc9b0e