Skip to content

Commit 0d15548

Browse files
authored
Merge pull request #313 from kswiecicki/memspace-host_all-qemu
Adjust memory size that should be left...
2 parents f4a1616 + 07bf215 commit 0d15548

File tree

1 file changed

+5
-4
lines changed

1 file changed

+5
-4
lines changed

test/memspaces/memspace_host_all.cpp

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -107,16 +107,17 @@ TEST_F(memspaceHostAllProviderTest, allocsSpreadAcrossAllNumaNodes) {
107107
// prolonging the test execution.
108108
size_t size = SIZE_4M;
109109
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;
110113

111114
long long numaCombinedFreeSize = 0;
112115
// Gather free size of all numa nodes.
113116
for (auto &id : nodeIds) {
114117
long long numaFreeSize = 0;
115118
long long numaSize = numa_node_size64(id, &numaFreeSize);
116119
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));
120121

121122
numaCombinedFreeSize += numaFreeSize;
122123
}
@@ -126,7 +127,7 @@ TEST_F(memspaceHostAllProviderTest, allocsSpreadAcrossAllNumaNodes) {
126127
// one allocation.
127128
std::vector<void *> allocs;
128129
std::unordered_set<size_t> allocNodeIds;
129-
while (numaCombinedFreeSize >= (long long)(2 * size)) {
130+
while (numaCombinedFreeSize >= (long long)(remainingSpace + size)) {
130131
void *ptr = nullptr;
131132
umf_ret = umfMemoryProviderAlloc(hProvider, size, alignment, &ptr);
132133
if (umf_ret != UMF_RESULT_SUCCESS) {

0 commit comments

Comments
 (0)