Skip to content
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

Conversation

ldorau
Copy link
Contributor

@ldorau ldorau commented Nov 8, 2024

Description

Add threshold to proxy lib to call system allocator
when a size is less than the given threshold (Linux only yet).

Ref: #894

Requires:

Checklist

  • Code compiles without errors locally
  • All tests pass locally
  • CI workflows execute properly

@ldorau ldorau force-pushed the Add_threshold_to_proxy_lib_to_call_system_allocator branch 10 times, most recently from 8bfade2 to 2a5fb9e Compare November 12, 2024 08:47
@ldorau ldorau changed the title [WIP] Add threshold to proxy lib to call system allocator Add threshold to proxy lib to call system allocator Nov 12, 2024
@ldorau ldorau force-pushed the Add_threshold_to_proxy_lib_to_call_system_allocator branch from 2a5fb9e to 4cdba02 Compare November 12, 2024 08:57
@ldorau ldorau marked this pull request as ready for review November 12, 2024 08:57
@ldorau ldorau requested a review from a team as a code owner November 12, 2024 08:57
@ldorau ldorau force-pushed the Add_threshold_to_proxy_lib_to_call_system_allocator branch 2 times, most recently from 0d3f0c7 to 7c781ef Compare November 12, 2024 11:34
src/proxy_lib/proxy_lib.c Outdated Show resolved Hide resolved
src/libumf.c Show resolved Hide resolved
lplewa
lplewa previously requested changes Nov 13, 2024
src/proxy_lib/proxy_lib.c Outdated Show resolved Hide resolved
@ldorau ldorau force-pushed the Add_threshold_to_proxy_lib_to_call_system_allocator branch from db760b2 to 4ac6b3e Compare November 14, 2024 09:02
.github/workflows/reusable_proxy_lib.yml Outdated Show resolved Hide resolved
src/libumf.c Outdated Show resolved Hide resolved
test/CMakeLists.txt Outdated Show resolved Hide resolved
src/proxy_lib/proxy_lib.c Outdated Show resolved Hide resolved
src/proxy_lib/proxy_lib.c Outdated Show resolved Hide resolved
src/proxy_lib/proxy_lib.c Show resolved Hide resolved
test/test_proxy_lib.cpp Outdated Show resolved Hide resolved
src/proxy_lib/proxy_lib.c Outdated Show resolved Hide resolved
test/test_proxy_lib.cpp Outdated Show resolved Hide resolved
test/test_proxy_lib.cpp Outdated Show resolved Hide resolved
@ldorau ldorau force-pushed the Add_threshold_to_proxy_lib_to_call_system_allocator branch from 4ac6b3e to 846f30b Compare November 14, 2024 15:14
@ldorau ldorau force-pushed the Add_threshold_to_proxy_lib_to_call_system_allocator branch 3 times, most recently from 3c04a4f to 6b833d1 Compare November 15, 2024 08:21
src/libumf.c Show resolved Hide resolved
src/libumf.c Show resolved Hide resolved
src/utils/utils_posix_common.c Outdated Show resolved Hide resolved
src/utils/utils_posix_common.c Outdated Show resolved Hide resolved
test/utils/utils_linux.cpp Show resolved Hide resolved
@ldorau ldorau force-pushed the Add_threshold_to_proxy_lib_to_call_system_allocator branch from 6b833d1 to 0a81104 Compare November 18, 2024 13:26
test/utils/utils_linux.cpp Show resolved Hide resolved
test/utils/utils_linux.cpp Show resolved Hide resolved
src/utils/utils_posix_common.c Outdated Show resolved Hide resolved
src/utils/utils_posix_common.c Outdated Show resolved Hide resolved
src/utils/utils_posix_common.c Outdated Show resolved Hide resolved
src/utils/utils_posix_common.c Outdated Show resolved Hide resolved
test/utils/utils_linux.cpp Show resolved Hide resolved
@ldorau ldorau force-pushed the Add_threshold_to_proxy_lib_to_call_system_allocator branch from 0a81104 to efc409a Compare November 18, 2024 17:25
@ldorau ldorau force-pushed the Add_threshold_to_proxy_lib_to_call_system_allocator branch from 797dfa6 to 29a18c0 Compare November 19, 2024 07:28
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]>
Add a size threshold to proxy lib to call system allocator
when the size is less than the given threshold (Linux only yet).

Signed-off-by: Lukasz Dorau <[email protected]>
This WA for the issue:
oneapi-src#894
It protects us from a recursion in malloc_usable_size()
when the JEMALLOC proxy_lib_pool is used.

TODO: remove this WA when the issue is fixed.

Signed-off-by: Lukasz Dorau <[email protected]>
The proxyLib_size_threshold_* tests test the size threshold
of the proxy library (Linux only yet). The size threshold
is set to 64 bytes in this test, so all allocations of:
1) size <  64 go through the default system allocator
   and (umfPoolByPtr(ptr_size < 64) == nullptr)
2) size >= 64 go through the proxy lib allocator
   and (umfPoolByPtr(ptr_size >= 64) != nullptr).

Ref: oneapi-src#894

Signed-off-by: Lukasz Dorau <[email protected]>
@ldorau ldorau force-pushed the Add_threshold_to_proxy_lib_to_call_system_allocator branch from 29a18c0 to 16ca017 Compare November 19, 2024 10:34
@ldorau
Copy link
Contributor Author

ldorau commented Nov 19, 2024

All CI builds passed

@lukaszstolarczuk lukaszstolarczuk merged commit 882a4c8 into oneapi-src:main Nov 19, 2024
77 checks passed
@ldorau ldorau deleted the Add_threshold_to_proxy_lib_to_call_system_allocator branch November 19, 2024 13:31
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants