@@ -107,16 +107,17 @@ TEST_F(memspaceHostAllProviderTest, allocsSpreadAcrossAllNumaNodes) {
107
107
// prolonging the test execution.
108
108
size_t size = SIZE_4M;
109
109
size_t alignment = 0 ;
110
+ // Unallocated memory space that has to be left in an attempt to avoid OOM
111
+ // killer - 512MB.
112
+ size_t remainingSpace = SIZE_4M * 128 ;
110
113
111
114
long long numaCombinedFreeSize = 0 ;
112
115
// Gather free size of all numa nodes.
113
116
for (auto &id : nodeIds) {
114
117
long long numaFreeSize = 0 ;
115
118
long long numaSize = numa_node_size64 (id, &numaFreeSize);
116
119
UT_ASSERTne (numaSize, -1 );
117
- // We need the space for at least two allocations, so that we can
118
- // have some space left to avoid OOM killer.
119
- UT_ASSERT (numaFreeSize >= (long long )(2 * size));
120
+ UT_ASSERT (numaFreeSize >= (long long )(remainingSpace + size));
120
121
121
122
numaCombinedFreeSize += numaFreeSize;
122
123
}
@@ -126,7 +127,7 @@ TEST_F(memspaceHostAllProviderTest, allocsSpreadAcrossAllNumaNodes) {
126
127
// one allocation.
127
128
std::vector<void *> allocs;
128
129
std::unordered_set<size_t > allocNodeIds;
129
- while (numaCombinedFreeSize >= (long long )(2 * size)) {
130
+ while (numaCombinedFreeSize >= (long long )(remainingSpace + size)) {
130
131
void *ptr = nullptr ;
131
132
umf_ret = umfMemoryProviderAlloc (hProvider, size, alignment, &ptr);
132
133
if (umf_ret != UMF_RESULT_SUCCESS) {
0 commit comments