From c70ab7d6309456e8758f5386d75649bae20d119b Mon Sep 17 00:00:00 2001 From: Krzysztof Swiecicki Date: Thu, 18 Jul 2024 08:14:15 +0000 Subject: [PATCH] Remove allocsSpreadAcrossAllNumaNodes test case This test case is removed because it provides too little value compared to the cost to setup this test in appropriate environment. It was the cause of sporadic fails on UR CI. --- test/memspaces/memspace_host_all.cpp | 88 ---------------------------- 1 file changed, 88 deletions(-) diff --git a/test/memspaces/memspace_host_all.cpp b/test/memspaces/memspace_host_all.cpp index 8d11aca0b..3b0825eb5 100644 --- a/test/memspaces/memspace_host_all.cpp +++ b/test/memspaces/memspace_host_all.cpp @@ -152,91 +152,3 @@ TEST_F(memspaceHostAllProviderTest, hostAllDefaults) { UT_ASSERTeq(ret, UMF_RESULT_SUCCESS); umfMemoryProviderDestroy(hProvider); } - -TEST_F(memspaceHostAllProviderTest, allocsSpreadAcrossAllNumaNodes) { - // This testcase is unsuitable for TSan. -#ifdef __SANITIZE_THREAD__ - GTEST_SKIP(); -#endif - - // Arbitrary allocation size, should be big enough to avoid unnecessarily - // prolonging the test execution. - size_t size = SIZE_4M; - size_t alignment = 0; - // Unallocated memory space that has to be left in an attempt to avoid OOM - // killer - 512MB. - size_t remainingSpace = SIZE_4M * 128; - - long long numaCombinedFreeSize = 0; - // Gather free size of all numa nodes. - for (auto &id : nodeIds) { - long long numaFreeSize = 0; - long long numaSize = numa_node_size64(id, &numaFreeSize); - UT_ASSERTne(numaSize, -1); - UT_ASSERT(numaFreeSize >= (long long)(remainingSpace + size)); - - numaCombinedFreeSize += numaFreeSize; - } - - umf_result_t umf_ret = UMF_RESULT_SUCCESS; - // Create allocations until all the NUMA nodes until there's space only for - // one allocation. - std::vector allocs; - std::unordered_set allocNodeIds; - while (numaCombinedFreeSize >= (long long)(remainingSpace + size)) { - void *ptr = nullptr; - umf_ret = umfMemoryProviderAlloc(hProvider, size, alignment, &ptr); - if (umf_ret != UMF_RESULT_SUCCESS) { - UT_ASSERTeq(umf_ret, UMF_RESULT_ERROR_MEMORY_PROVIDER_SPECIFIC); - const char *msg = nullptr; - int32_t err = 0; - umfMemoryProviderGetLastNativeError(hProvider, &msg, &err); - // In this scenario, 'UMF_OS_RESULT_ERROR_ALLOC_FAILED' indicates OOM. - UT_ASSERTeq(err, UMF_OS_RESULT_ERROR_ALLOC_FAILED); - break; - } - - UT_ASSERTne(ptr, nullptr); - // Access the allocation, so that all the pages associated with it are - // allocated on available NUMA nodes. - memset(ptr, 0xFF, size); - - int mode = -1; - std::vector boundNodeIds; - size_t allocNodeId = SIZE_MAX; - getAllocationPolicy(ptr, maxNodeId, mode, boundNodeIds, allocNodeId); - - // In case of 'HOST ALL' memspace, the default set of nodes (that - // contains all available nodes) is used but get_mempolicy() would - // return an empty set of nodes. - UT_ASSERTeq(mode, MPOL_DEFAULT); - UT_ASSERTeq(boundNodeIds.size(), 0); - - // Confirm that the memory is allocated on one of the nodes in - // 'HOST ALL' memspace. - auto it = std::find(nodeIds.begin(), nodeIds.end(), allocNodeId); - UT_ASSERT(it != nodeIds.end()); - - allocs.push_back(ptr); - allocNodeIds.insert(allocNodeId); - - numaCombinedFreeSize -= size; - } - - UT_ASSERT(allocs.size() >= nodeIds.size()); - for (auto &ptr : allocs) { - umf_ret = umfMemoryProviderFree(hProvider, ptr, size); - UT_ASSERTeq(umf_ret, UMF_RESULT_SUCCESS); - } - - // TODO: we want to enable this check only when tests are running under QEMU. - // Otherwise it might sporadically fail on a real system where other processes - // occupied all memory from a aparticular NUMA node. -#if 0 - // Confirm that all the NUMA nodes bound to 'HOST ALL' memspace were exhausted. - for (auto &id : nodeIds) { - auto it = std::find(allocNodeIds.begin(), allocNodeIds.end(), id); - UT_ASSERT(it != allocNodeIds.end()); - } -#endif -}