[LTP] [PATCH] kernel/hugemmap05.c: Skip test when default Hugepagesize 1G
Wang Kunfeng
threefifteen.wangkunfeng@huawei.com
Fri Apr 22 05:35:52 CEST 2022
The kernel is not allow to change the file that
/proc/sys/vm/nr_overcommit_hugepages,
when default Hugepagesize 1G,so the testcase
will be fail when close it.
Signen-off-by: Wang Kunfeng <threefifteen.wangkunfeng@huawei.com>
---
testcases/kernel/mem/hugetlb/hugemmap/hugemmap05.c | 5 +++++
1 file changed, 5 insertions(+)
diff --git a/testcases/kernel/mem/hugetlb/hugemmap/hugemmap05.c b/testcases/kernel/mem/hugetlb/hugemmap/hugemmap05.c
index 40d3bd8da..5c78d0635 100644
--- a/testcases/kernel/mem/hugetlb/hugemmap/hugemmap05.c
+++ b/testcases/kernel/mem/hugetlb/hugemmap/hugemmap05.c
@@ -61,6 +61,7 @@ static int key = -1, shmid = -1, fd = -1;
static int mounted, restore_shmmax, restore_overcomm_hgpgs;
static long hugepagesize, nr_overcommit_hugepages;
static long size = NR_HPAGES, length = (NR_HPAGES + NR_HPAGES/2) * 2;
+static long default_hugepagesize = 1048576;
char *opt_sysfs;
char *opt_alloc;
@@ -188,6 +189,10 @@ static void setup(void)
if (tst_hugepages != NR_HPAGES)
tst_brk(TCONF, "Not enough hugepages for testing!");
+ hugepagesize = SAFE_READ_MEMINFO("Hugepagesize:");
+ if (hugepagesize == default_hugepagesize)
+ tst_brk(TCONF, "system hugepagesize default 1G,the testcase not support!");
+
hugepagesize = SAFE_READ_MEMINFO("Hugepagesize:") * 1024;
init_sys_sz_paths();
2.17.1
More information about the ltp
mailing list