-
Notifications
You must be signed in to change notification settings - Fork 28
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
Add threshold to proxy lib to call system allocator #883
base: main
Are you sure you want to change the base?
Add threshold to proxy lib to call system allocator #883
Conversation
8bfade2
to
2a5fb9e
Compare
2a5fb9e
to
4cdba02
Compare
4cdba02
to
0d3f0c7
Compare
Signed-off-by: Lukasz Dorau <[email protected]>
Signed-off-by: Lukasz Dorau <[email protected]>
Do not assert(ptr) in umfMemoryTrackerGetAllocInfo(), return UMF_RESULT_ERROR_INVALID_ARGUMENT instead. Replace LOG_WARN() with LOG_DEBUG().
Add utils_env_var_get_str() to utils_common. Use utils_env_var_get_str() inside utils_env_var_has_str() and utils_is_running_in_proxy_lib(). Signed-off-by: Lukasz Dorau <[email protected]>
0d3f0c7
to
7c781ef
Compare
UMF_PROXY="size.threshold=128" | ||
UMF_LOG="level:debug;flush:debug;output:stderr;pid:yes" | ||
LD_PRELOAD=./lib/libumf_proxy.so | ||
ctest --output-on-failure -E provider_file_memory_ipc |
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.
we should have a test where you use umfPoolByPtr() to check allocs smaller than threshold were not registered in the tracker
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.
I will add a test for that
Signed-off-by: Lukasz Dorau <[email protected]>
Add a size threshold to proxy lib to call system allocator when the size is less than the given threshold. Signed-off-by: Lukasz Dorau <[email protected]>
7c781ef
to
db760b2
Compare
src/proxy_lib/proxy_lib.c
Outdated
if (Proxy_pool) { | ||
if (!was_called_from_umfPool && Proxy_pool && | ||
(umfPoolByPtr(ptr) == Proxy_pool)) { | ||
was_called_from_umfPool = 1; | ||
void *new_ptr = umfPoolRealloc(Proxy_pool, ptr, size); | ||
was_called_from_umfPool = 0; | ||
return new_ptr; | ||
} | ||
|
||
assert(0); | ||
if (threshold_value) { | ||
return system_realloc(ptr, size); | ||
} | ||
|
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.
Please add test
ptr = Malloc(threshold_value + 1)
realloc(ptr, threshold_value - 1)
and vice versa.
ptr = Malloc(threshold_value - 1)
realloc(ptr, threshold_value + 1)
Both cases check then umfPoolByPtr if it returns expected value.
(atm in this PR we are not supporting this correctly - if we increasing or decrease size of allocation thru realoc we should "realloc this allocation" to correct allocator.
Description
Add threshold to proxy lib to call system allocator
when a size is less than the given threshold.
Ref: #894
Requires:
Checklist