Skip to content

Commit c70ab7d

Browse files
committed
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.
1 parent cb6b8bb commit c70ab7d

File tree

1 file changed

+0
-88
lines changed

1 file changed

+0
-88
lines changed

test/memspaces/memspace_host_all.cpp

Lines changed: 0 additions & 88 deletions
Original file line numberDiff line numberDiff line change
@@ -152,91 +152,3 @@ TEST_F(memspaceHostAllProviderTest, hostAllDefaults) {
152152
UT_ASSERTeq(ret, UMF_RESULT_SUCCESS);
153153
umfMemoryProviderDestroy(hProvider);
154154
}
155-
156-
TEST_F(memspaceHostAllProviderTest, allocsSpreadAcrossAllNumaNodes) {
157-
// This testcase is unsuitable for TSan.
158-
#ifdef __SANITIZE_THREAD__
159-
GTEST_SKIP();
160-
#endif
161-
162-
// Arbitrary allocation size, should be big enough to avoid unnecessarily
163-
// prolonging the test execution.
164-
size_t size = SIZE_4M;
165-
size_t alignment = 0;
166-
// Unallocated memory space that has to be left in an attempt to avoid OOM
167-
// killer - 512MB.
168-
size_t remainingSpace = SIZE_4M * 128;
169-
170-
long long numaCombinedFreeSize = 0;
171-
// Gather free size of all numa nodes.
172-
for (auto &id : nodeIds) {
173-
long long numaFreeSize = 0;
174-
long long numaSize = numa_node_size64(id, &numaFreeSize);
175-
UT_ASSERTne(numaSize, -1);
176-
UT_ASSERT(numaFreeSize >= (long long)(remainingSpace + size));
177-
178-
numaCombinedFreeSize += numaFreeSize;
179-
}
180-
181-
umf_result_t umf_ret = UMF_RESULT_SUCCESS;
182-
// Create allocations until all the NUMA nodes until there's space only for
183-
// one allocation.
184-
std::vector<void *> allocs;
185-
std::unordered_set<size_t> allocNodeIds;
186-
while (numaCombinedFreeSize >= (long long)(remainingSpace + size)) {
187-
void *ptr = nullptr;
188-
umf_ret = umfMemoryProviderAlloc(hProvider, size, alignment, &ptr);
189-
if (umf_ret != UMF_RESULT_SUCCESS) {
190-
UT_ASSERTeq(umf_ret, UMF_RESULT_ERROR_MEMORY_PROVIDER_SPECIFIC);
191-
const char *msg = nullptr;
192-
int32_t err = 0;
193-
umfMemoryProviderGetLastNativeError(hProvider, &msg, &err);
194-
// In this scenario, 'UMF_OS_RESULT_ERROR_ALLOC_FAILED' indicates OOM.
195-
UT_ASSERTeq(err, UMF_OS_RESULT_ERROR_ALLOC_FAILED);
196-
break;
197-
}
198-
199-
UT_ASSERTne(ptr, nullptr);
200-
// Access the allocation, so that all the pages associated with it are
201-
// allocated on available NUMA nodes.
202-
memset(ptr, 0xFF, size);
203-
204-
int mode = -1;
205-
std::vector<size_t> boundNodeIds;
206-
size_t allocNodeId = SIZE_MAX;
207-
getAllocationPolicy(ptr, maxNodeId, mode, boundNodeIds, allocNodeId);
208-
209-
// In case of 'HOST ALL' memspace, the default set of nodes (that
210-
// contains all available nodes) is used but get_mempolicy() would
211-
// return an empty set of nodes.
212-
UT_ASSERTeq(mode, MPOL_DEFAULT);
213-
UT_ASSERTeq(boundNodeIds.size(), 0);
214-
215-
// Confirm that the memory is allocated on one of the nodes in
216-
// 'HOST ALL' memspace.
217-
auto it = std::find(nodeIds.begin(), nodeIds.end(), allocNodeId);
218-
UT_ASSERT(it != nodeIds.end());
219-
220-
allocs.push_back(ptr);
221-
allocNodeIds.insert(allocNodeId);
222-
223-
numaCombinedFreeSize -= size;
224-
}
225-
226-
UT_ASSERT(allocs.size() >= nodeIds.size());
227-
for (auto &ptr : allocs) {
228-
umf_ret = umfMemoryProviderFree(hProvider, ptr, size);
229-
UT_ASSERTeq(umf_ret, UMF_RESULT_SUCCESS);
230-
}
231-
232-
// TODO: we want to enable this check only when tests are running under QEMU.
233-
// Otherwise it might sporadically fail on a real system where other processes
234-
// occupied all memory from a aparticular NUMA node.
235-
#if 0
236-
// Confirm that all the NUMA nodes bound to 'HOST ALL' memspace were exhausted.
237-
for (auto &id : nodeIds) {
238-
auto it = std::find(allocNodeIds.begin(), allocNodeIds.end(), id);
239-
UT_ASSERT(it != allocNodeIds.end());
240-
}
241-
#endif
242-
}

0 commit comments

Comments
 (0)