* [Devel] [PATCH vz10] selftests: dma-buf: skip the huge page test without huge pages
@ 2026-09-01 0:41 Eva Kurchatova
2026-09-01 21:31 ` Konstantin Khorenko
2026-09-01 21:33 ` Konstantin Khorenko
0 siblings, 2 replies; 3+ messages in thread
From: Eva Kurchatova @ 2026-09-01 0:41 UTC (permalink / raw)
To: khorenko; +Cc: devel
The last udmabuf test backs a memfd with MFD_HUGETLB. Where no huge
pages are reserved the mapping fails and the whole test is reported as
a failure.
https://virtuozzo.atlassian.net/browse/VSTOR-142448
Feature: fix selftests
Signed-off-by: Eva Kurchatova <eva.kurchatova@virtuozzo.com>
---
.../selftests/drivers/dma-buf/udmabuf.c | 20 +++++++++++++++++++
1 file changed, 20 insertions(+)
diff --git a/tools/testing/selftests/drivers/dma-buf/udmabuf.c b/tools/testing/selftests/drivers/dma-buf/udmabuf.c
index 6062723a172e..a3bb26c1991a 100644
--- a/tools/testing/selftests/drivers/dma-buf/udmabuf.c
+++ b/tools/testing/selftests/drivers/dma-buf/udmabuf.c
@@ -25,6 +25,21 @@
static unsigned int page_size;
+static bool hugepages_available(void)
+{
+ unsigned long nr = 0;
+ FILE *f;
+
+ f = fopen("/proc/sys/vm/nr_hugepages", "r");
+ if (!f)
+ return false;
+ if (fscanf(f, "%lu", &nr) != 1)
+ nr = 0;
+ fclose(f);
+
+ return nr > 0;
+}
+
static int create_memfd_with_seals(off64_t size, bool hpage)
{
int memfd, ret;
@@ -234,6 +249,11 @@ int main(int argc, char *argv[])
close(memfd);
/* should work (migration of 2MB size huge pages)*/
+ if (!hugepages_available()) {
+ ksft_test_result_skip("%s: [SKIP,test-6] no huge pages\n", TEST_PREFIX);
+ close(devfd);
+ ksft_finished();
+ }
page_size = getpagesize() * 512; /* 2 MB */
size = MEMFD_SIZE * page_size;
memfd = create_memfd_with_seals(size, true);
--
2.55.0
_______________________________________________
Devel mailing list
Devel@openvz.org
https://lists.openvz.org/mailman/listinfo/devel
^ permalink raw reply [flat|nested] 3+ messages in thread
end of thread, other threads:[~2026-09-01 21:36 UTC | newest]
Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2026-09-01 0:41 [Devel] [PATCH vz10] selftests: dma-buf: skip the huge page test without huge pages Eva Kurchatova
2026-09-01 21:31 ` Konstantin Khorenko
2026-09-01 21:33 ` Konstantin Khorenko
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.