Skip to content

Commit 69d6496

Browse files
committed
Add support for mapping with MAP_SYNC to file provider
Add support for mapping with MAP_SYNC to file provider: use utils_mmap_file() instead of utils_mmap(). Signed-off-by: Lukasz Dorau <[email protected]>
1 parent 2e54f44 commit 69d6496

File tree

2 files changed

+6
-3
lines changed

2 files changed

+6
-3
lines changed

README.md

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -200,6 +200,8 @@ so it should be used with a pool manager that will take over
200200
the managing of the provided memory - for example the jemalloc pool
201201
with the `disable_provider_free` parameter set to true.
202202

203+
The memory visibility mode parameter must be set to `UMF_MEM_MAP_SYNC` in case of FSDAX.
204+
203205
##### Requirements
204206

205207
1) Linux OS

src/provider/provider_file_memory.c

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -261,7 +261,7 @@ static umf_result_t file_mmap_aligned(file_memory_provider_t *file_provider,
261261
ASSERT_IS_ALIGNED(extended_size, page_size);
262262
ASSERT_IS_ALIGNED(offset_fd, page_size);
263263

264-
void *ptr = utils_mmap(NULL, extended_size, prot, flag, fd, offset_fd);
264+
void *ptr = utils_mmap_file(NULL, extended_size, prot, flag, fd, offset_fd);
265265
if (ptr == NULL) {
266266
LOG_PERR("memory mapping failed");
267267
return UMF_RESULT_ERROR_MEMORY_PROVIDER_SPECIFIC;
@@ -612,8 +612,9 @@ static umf_result_t file_open_ipc_handle(void *provider, void *providerIpcData,
612612
return UMF_RESULT_ERROR_INVALID_ARGUMENT;
613613
}
614614

615-
*ptr = utils_mmap(NULL, file_ipc_data->size, file_provider->protection,
616-
file_provider->visibility, fd, file_ipc_data->offset_fd);
615+
*ptr = utils_mmap_file(NULL, file_ipc_data->size, file_provider->protection,
616+
file_provider->visibility, fd,
617+
file_ipc_data->offset_fd);
617618
(void)utils_close_fd(fd);
618619
if (*ptr == NULL) {
619620
file_store_last_native_error(UMF_FILE_RESULT_ERROR_ALLOC_FAILED, errno);

0 commit comments

Comments
 (0)