linux-mm.kvack.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] selftests/mm: uffd-unit-test check if huge page size is 0
@ 2024-02-05 14:50 Terry Tritton
  0 siblings, 0 replies; only message in thread
From: Terry Tritton @ 2024-02-05 14:50 UTC (permalink / raw)
  To: akpm, shuah
  Cc: linux-mm, linux-kselftest, linux-kernel, peter.griffin,
	bettyzhou, Terry Tritton

If HUGETLBFS is not enabled then the default_huge_page_size function will
return 0 and cause a divide by 0 error. Add a check to see if the huge page
size is 0 and skip the hugetlb tests if it is.

Signed-off-by: Terry Tritton <terry.tritton@linaro.org>
---
 tools/testing/selftests/mm/uffd-unit-tests.c | 6 ++++++
 1 file changed, 6 insertions(+)

diff --git a/tools/testing/selftests/mm/uffd-unit-tests.c b/tools/testing/selftests/mm/uffd-unit-tests.c
index cce90a10515a..2b9f8cc52639 100644
--- a/tools/testing/selftests/mm/uffd-unit-tests.c
+++ b/tools/testing/selftests/mm/uffd-unit-tests.c
@@ -1517,6 +1517,12 @@ int main(int argc, char *argv[])
 				continue;
 
 			uffd_test_start("%s on %s", test->name, mem_type->name);
+			if ((mem_type->mem_flag == MEM_HUGETLB ||
+			    mem_type->mem_flag == MEM_HUGETLB_PRIVATE) &&
+			    (default_huge_page_size() == 0)) {
+				uffd_test_skip("huge page size is 0, feature missing?");
+				continue;
+			}
 			if (!uffd_feature_supported(test)) {
 				uffd_test_skip("feature missing");
 				continue;
-- 
2.43.0.594.gd9cf4e227d-goog



^ permalink raw reply	[flat|nested] only message in thread

only message in thread, other threads:[~2024-02-05 14:52 UTC | newest]

Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2024-02-05 14:50 [PATCH] selftests/mm: uffd-unit-test check if huge page size is 0 Terry Tritton

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox