Skip to content

Add internal IPC-consumer-only mode to the devdax provider #831

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

Closed
Show file tree
Hide file tree
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
15 changes: 15 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -193,6 +193,21 @@ so it should be used with a pool manager that will take over
the managing of the provided memory - for example the jemalloc pool
with the `disable_provider_free` parameter set to true.

When the DevDax provider is started with `path == NULL` and `size == 0` input parameters
(`umf_devdax_memory_provider_params_t`) it is working in the **IPC-consumer-only** mode
with limited functionality. The following API is **unsupported** in IPC-consumer-only mode
(always return `UMF_RESULT_ERROR_NOT_SUPPORTED`):
- `umfMemoryProviderAlloc()`
- `umfMemoryProviderFree()` (always unsupported)
- `umfMemoryProviderPurgeLazy()` (always unsupported)
- `umfMemoryProviderPurgeForce()`
- `umfMemoryProviderAllocationSplit()`
- `umfMemoryProviderAllocationMerge()`
- `umfMemoryProviderGetIPCHandle()`
- `umfMemoryProviderPutIPCHandle()`

The rest of the API works normally.

##### Requirements

1) Linux OS
Expand Down
6 changes: 4 additions & 2 deletions src/base_alloc/base_alloc.c
Original file line number Diff line number Diff line change
Expand Up @@ -168,7 +168,8 @@ umf_ba_pool_t *umf_ba_create(size_t size) {
char *data_ptr = (char *)&pool->data;
size_t size_left = pool_size - offsetof(umf_ba_pool_t, data);

utils_align_ptr_size((void **)&data_ptr, &size_left, MEMORY_ALIGNMENT);
utils_align_ptr_up_size_down((void **)&data_ptr, &size_left,
MEMORY_ALIGNMENT);

// init free_lock
utils_mutex_t *mutex = utils_mutex_init(&pool->metadata.free_lock);
Expand Down Expand Up @@ -209,7 +210,8 @@ void *umf_ba_alloc(umf_ba_pool_t *pool) {
size_t size_left =
pool->metadata.pool_size - offsetof(umf_ba_next_pool_t, data);

utils_align_ptr_size((void **)&data_ptr, &size_left, MEMORY_ALIGNMENT);
utils_align_ptr_up_size_down((void **)&data_ptr, &size_left,
MEMORY_ALIGNMENT);
ba_divide_memory_into_chunks(pool, data_ptr, size_left);
}

Expand Down
4 changes: 2 additions & 2 deletions src/base_alloc/base_alloc_linear.c
Original file line number Diff line number Diff line change
Expand Up @@ -98,7 +98,7 @@ umf_ba_linear_pool_t *umf_ba_linear_create(size_t pool_size) {
void *data_ptr = &pool->data;
size_t size_left = pool_size - offsetof(umf_ba_linear_pool_t, data);

utils_align_ptr_size(&data_ptr, &size_left, MEMORY_ALIGNMENT);
utils_align_ptr_up_size_down(&data_ptr, &size_left, MEMORY_ALIGNMENT);

pool->metadata.pool_size = pool_size;
pool->metadata.data_ptr = data_ptr;
Expand Down Expand Up @@ -149,7 +149,7 @@ void *umf_ba_linear_alloc(umf_ba_linear_pool_t *pool, size_t size) {
void *data_ptr = &new_pool->data;
size_t size_left =
new_pool->pool_size - offsetof(umf_ba_next_linear_pool_t, data);
utils_align_ptr_size(&data_ptr, &size_left, MEMORY_ALIGNMENT);
utils_align_ptr_up_size_down(&data_ptr, &size_left, MEMORY_ALIGNMENT);

pool->metadata.data_ptr = data_ptr;
pool->metadata.size_left = size_left;
Expand Down
Loading
Loading