Skip to content

Adjust memory size that should be left... #313

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Mar 8, 2024
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
9 changes: 5 additions & 4 deletions test/memspaces/memspace_host_all.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -107,16 +107,17 @@ TEST_F(memspaceHostAllProviderTest, allocsSpreadAcrossAllNumaNodes) {
// 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);
// We need the space for at least two allocations, so that we can
// have some space left to avoid OOM killer.
UT_ASSERT(numaFreeSize >= (long long)(2 * size));
UT_ASSERT(numaFreeSize >= (long long)(remainingSpace + size));

numaCombinedFreeSize += numaFreeSize;
}
Expand All @@ -126,7 +127,7 @@ TEST_F(memspaceHostAllProviderTest, allocsSpreadAcrossAllNumaNodes) {
// one allocation.
std::vector<void *> allocs;
std::unordered_set<size_t> allocNodeIds;
while (numaCombinedFreeSize >= (long long)(2 * size)) {
while (numaCombinedFreeSize >= (long long)(remainingSpace + size)) {
void *ptr = nullptr;
umf_ret = umfMemoryProviderAlloc(hProvider, size, alignment, &ptr);
if (umf_ret != UMF_RESULT_SUCCESS) {
Expand Down