Skip to contentSkip to conversation

hugemmap32: Check for hugetlbfs availability

PATCH In review Martin Doucha 2 participants 2 messages May 11, 2023

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 hugemmap32: Check for hugetlbfs availability

Trying to open PATH_HUGEPAGE unconditionally will fail if hugepage support is disabled in kernel or not provided by hardware.

---
 testcases/kernel/mem/hugetlb/hugemmap/hugemmap32.c | 3 +++
 1 file changed, 3 insertions(+)
testcases/kernel/mem/hugetlb/hugemmap/hugemmap32.c +3 -0
index 85d57319f..36a426a09 100644
@@ -47,6 +47,9 @@ static void setup(void)
 	struct dirent *ent;
 	unsigned long hpage_size;
 
+	if (access(PATH_HUGEPAGE, F_OK))
+		tst_brk(TCONF, "hugetlbfs is not supported");
+
 	dir = SAFE_OPENDIR(PATH_HUGEPAGE);
 	while ((ent = SAFE_READDIR(dir))) {
 		if ((sscanf(ent->d_name, "hugepages-%lukB", &hpage_size) == 1) &&
Signature · 5 lines
2.40.0


-- 
Mailing list info: https://lists.linux.it/listinfo/ltp