-
Notifications
You must be signed in to change notification settings - Fork 37
add umfPoolTrimMemory #1318
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
base: main
Are you sure you want to change the base?
add umfPoolTrimMemory #1318
Conversation
6de8410
to
6a3ae03
Compare
4a3b48f
to
4dee8a2
Compare
a699662
to
c151a5c
Compare
src/pool/pool_disjoint.c
Outdated
if (hPool == NULL) { | ||
return UMF_RESULT_ERROR_INVALID_ARGUMENT; | ||
} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
If you introduce UMF_CHECK
above, please apply it here as well.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
changed to assert as this is checked in the upper layer
test/memoryPoolAPI.cpp
Outdated
// TODO enable jemalloc pool tests | ||
//poolCreateExtParams{umfJemallocPoolOps(), nullptr, nullptr, | ||
// &BA_GLOBAL_PROVIDER_OPS, nullptr, nullptr})); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Correct indentation and add information when it should be enabled
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
removed + created an issue #1455
ops->ext_trim_memory(pool, pool->buckets[0]->size); | ||
EXPECT_EQ(pool->buckets[0]->available_slabs_num, 1); | ||
EXPECT_EQ(pool->buckets[0]->curr_slabs_in_pool, 1); | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
perhaps add testing various values of minBytesToKeep
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
added new case with 3 * slab_size to keep
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
thx, but now the CI is failing...? ;)
6d877f9
to
c523215
Compare
02c6e96
to
c2a5994
Compare
disjoint_pool_t *hPool = (disjoint_pool_t *)pool; | ||
|
||
// tracking the number of bytes left to keep | ||
int bytesLeftToKeep = (int)minBytesToKeep; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
You cast from 8 byte unsigned variable to 4 byte signed variable
(void)pool; // unused | ||
(void)minBytesToKeep; // unused | ||
|
||
return UMF_RESULT_SUCCESS; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Technically it is success, as this function has no promises, but for me it is ERROR NONSUPPORTED
// use CTL to get the current memory pool size (if supported) | ||
size_t reserved_memory1 = 0; | ||
ret = umfCtlGet("umf.pool.by_handle.{}.stats.reserved_memory", | ||
&reserved_memory1, sizeof(size_t), hPool); | ||
if (ret == UMF_RESULT_SUCCESS) { | ||
ASSERT_GE(reserved_memory1, 0ull); | ||
} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It supported by all pools now
ret = umfCtlGet("umf.pool.by_handle.{}.stats.reserved_memory", | ||
&reserved_memory2, sizeof(size_t), hPool); | ||
if (ret == UMF_RESULT_SUCCESS) { | ||
ASSERT_EQ(reserved_memory2, 0ull); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Do this test work with tbbpool - it does nothing on trim so this test should fail. Why it is not failing?
implement umfPoolTrimMemory