Blame SOURCES/0010-tests-counters-Skip-if-using-gigantic-huge-pages.patch

fc9b0e
From 2d41ec367199f9f9d4b7caf00c3be25030a7a873 Mon Sep 17 00:00:00 2001
fc9b0e
Message-Id: <2d41ec367199f9f9d4b7caf00c3be25030a7a873.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: Thu, 15 Aug 2019 13:08:37 +0530
fc9b0e
Subject: [RHEL7 PATCH 10/31] tests: counters: Skip if using gigantic huge
fc9b0e
 pages
fc9b0e
fc9b0e
The kernel does not allow setting an overcommit limit for
fc9b0e
gigantic huge pages, i.e. any page size beyond the max page
fc9b0e
allocation order. For such cases, nr_overcommit_hugepages
fc9b0e
cannot be modified and is always zero. So, skip this test
fc9b0e
as mmap() using a hugetlbfs file descriptor will fail when
fc9b0e
both nr_hugepages and nr_overcommit_hugepages are zero.
fc9b0e
fc9b0e
Signed-off-by: Sandipan Das <sandipan@linux.ibm.com>
fc9b0e
Signed-off-by: Eric B Munson <emunson@mgebm.net>
fc9b0e
Signed-off-by: Rafael Aquini <aquini@redhat.com>
fc9b0e
---
fc9b0e
 tests/counters.c | 12 +++++++++++-
fc9b0e
 1 file changed, 11 insertions(+), 1 deletion(-)
fc9b0e
fc9b0e
diff --git a/tests/counters.c b/tests/counters.c
fc9b0e
index 0284809..34b1ef3 100644
fc9b0e
--- a/tests/counters.c
fc9b0e
+++ b/tests/counters.c
fc9b0e
@@ -83,7 +83,17 @@ void verify_dynamic_pool_support(void)
fc9b0e
 	saved_oc_hugepages = get_huge_page_counter(hpage_size, HUGEPAGES_OC);
fc9b0e
 	if (saved_oc_hugepages < 0)
fc9b0e
 		FAIL("Kernel appears to lack dynamic hugetlb pool support");
fc9b0e
-	set_nr_overcommit_hugepages(hpage_size, 10);
fc9b0e
+	if (set_nr_overcommit_hugepages(hpage_size, 10) < 0) {
fc9b0e
+		/*
fc9b0e
+		 * In case writing to nr_overcommit_hugepages failed with the
fc9b0e
+		 * reason that it was an attempt to write an invalid argument,
fc9b0e
+		 * it might be because the page size corresponds to gigantic
fc9b0e
+		 * pages which do not support this feature.
fc9b0e
+		 */
fc9b0e
+		if (errno == EINVAL)
fc9b0e
+			check_if_gigantic_page();
fc9b0e
+		FAIL("Couldn't set overcommit limit");
fc9b0e
+	}
fc9b0e
 }
fc9b0e
 
fc9b0e
 void bad_value(int line, const char *name, long expect, long actual)
fc9b0e
-- 
fc9b0e
1.8.3.1
fc9b0e