From 587676fee8a77046e67d3ae8eb26e5456b6da481 Mon Sep 17 00:00:00 2001 From: Guangli Dai Date: Wed, 11 Dec 2024 15:24:26 -0800 Subject: [PATCH] Disable psset test when hugepage size is too large. --- include/jemalloc/internal/hpa.h | 1 + src/hpa.c | 7 ++++++- test/unit/psset.c | 12 ++++++++++++ 3 files changed, 19 insertions(+), 1 deletion(-) diff --git a/include/jemalloc/internal/hpa.h b/include/jemalloc/internal/hpa.h index 4c410c40..1f90a15f 100644 --- a/include/jemalloc/internal/hpa.h +++ b/include/jemalloc/internal/hpa.h @@ -151,6 +151,7 @@ struct hpa_shard_s { nstime_t last_purge; }; +bool hpa_hugepage_size_exceeds_limit(); /* * Whether or not the HPA can be used given the current configuration. This is * is not necessarily a guarantee that it backs its allocations by hugepages, diff --git a/src/hpa.c b/src/hpa.c index 14541413..cb3f978c 100644 --- a/src/hpa.c +++ b/src/hpa.c @@ -24,6 +24,11 @@ static void hpa_dalloc_batch(tsdn_t *tsdn, pai_t *self, edata_list_active_t *list, bool *deferred_work_generated); static uint64_t hpa_time_until_deferred_work(tsdn_t *tsdn, pai_t *self); +bool +hpa_hugepage_size_exceeds_limit() { + return HUGEPAGE > HUGEPAGE_MAX_EXPECTED_SIZE; +} + bool hpa_supported(void) { #ifdef _WIN32 @@ -52,7 +57,7 @@ hpa_supported(void) { return false; } /* As mentioned in pages.h, do not support If HUGEPAGE is too large. */ - if (HUGEPAGE > HUGEPAGE_MAX_EXPECTED_SIZE) { + if (hpa_hugepage_size_exceeds_limit()) { return false; } return true; diff --git a/test/unit/psset.c b/test/unit/psset.c index 6bfdbb5f..c400f3b9 100644 --- a/test/unit/psset.c +++ b/test/unit/psset.c @@ -120,6 +120,7 @@ edata_expect(edata_t *edata, size_t page_offset, size_t page_cnt) { } TEST_BEGIN(test_empty) { + test_skip_if(hpa_hugepage_size_exceeds_limit()); bool err; hpdata_t pageslab; hpdata_init(&pageslab, PAGESLAB_ADDR, PAGESLAB_AGE); @@ -137,6 +138,7 @@ TEST_BEGIN(test_empty) { TEST_END TEST_BEGIN(test_fill) { + test_skip_if(hpa_hugepage_size_exceeds_limit()); bool err; hpdata_t pageslab; @@ -169,6 +171,7 @@ TEST_BEGIN(test_fill) { TEST_END TEST_BEGIN(test_reuse) { + test_skip_if(hpa_hugepage_size_exceeds_limit()); bool err; hpdata_t *ps; @@ -261,6 +264,7 @@ TEST_BEGIN(test_reuse) { TEST_END TEST_BEGIN(test_evict) { + test_skip_if(hpa_hugepage_size_exceeds_limit()); bool err; hpdata_t *ps; @@ -295,6 +299,7 @@ TEST_BEGIN(test_evict) { TEST_END TEST_BEGIN(test_multi_pageslab) { + test_skip_if(hpa_hugepage_size_exceeds_limit()); bool err; hpdata_t *ps; @@ -420,6 +425,7 @@ TEST_END TEST_BEGIN(test_stats_huge) { test_skip_if(!config_stats); + test_skip_if(hpa_hugepage_size_exceeds_limit()); hpdata_t pageslab; hpdata_init(&pageslab, PAGESLAB_ADDR, PAGESLAB_AGE); @@ -542,6 +548,7 @@ stats_expect(psset_t *psset, size_t nactive) { TEST_BEGIN(test_stats_fullness) { test_skip_if(!config_stats); + test_skip_if(hpa_hugepage_size_exceeds_limit()); bool err; @@ -637,6 +644,7 @@ init_test_pageslabs(psset_t *psset, hpdata_t *pageslab, } TEST_BEGIN(test_oldest_fit) { + test_skip_if(hpa_hugepage_size_exceeds_limit()); bool err; edata_t alloc[HUGEPAGE_PAGES]; edata_t worse_alloc[HUGEPAGE_PAGES]; @@ -660,6 +668,7 @@ TEST_BEGIN(test_oldest_fit) { TEST_END TEST_BEGIN(test_insert_remove) { + test_skip_if(hpa_hugepage_size_exceeds_limit()); bool err; hpdata_t *ps; edata_t alloc[HUGEPAGE_PAGES]; @@ -706,6 +715,7 @@ TEST_BEGIN(test_insert_remove) { TEST_END TEST_BEGIN(test_purge_prefers_nonhuge) { + test_skip_if(hpa_hugepage_size_exceeds_limit()); /* * All else being equal, we should prefer purging non-huge pages over * huge ones for non-empty extents. @@ -789,6 +799,7 @@ TEST_BEGIN(test_purge_prefers_nonhuge) { TEST_END TEST_BEGIN(test_purge_prefers_empty) { + test_skip_if(hpa_hugepage_size_exceeds_limit()); void *ptr; psset_t psset; @@ -825,6 +836,7 @@ TEST_BEGIN(test_purge_prefers_empty) { TEST_END TEST_BEGIN(test_purge_prefers_empty_huge) { + test_skip_if(hpa_hugepage_size_exceeds_limit()); void *ptr; psset_t psset;