@@ -448,8 +448,10 @@ static umf_result_t devdax_open_ipc_handle(void *provider,
448448 unsigned map_sync_flag = 0 ;
449449 utils_translate_mem_visibility_flag (UMF_MEM_MAP_SYNC , & map_sync_flag );
450450
451+ size_t length_aligned = ALIGN_UP (devdax_ipc_data -> length , DEVDAX_PAGE_SIZE_2MB );
452+
451453 // mmap /dev/dax with the MAP_SYNC xor MAP_SHARED flag (if MAP_SYNC fails)
452- char * addr = utils_mmap_file (NULL , devdax_ipc_data -> length ,
454+ char * addr = utils_mmap_file (NULL , length_aligned ,
453455 devdax_ipc_data -> protection , map_sync_flag , fd ,
454456 devdax_ipc_data -> offset );
455457 if (addr == NULL ) {
@@ -461,14 +463,9 @@ static umf_result_t devdax_open_ipc_handle(void *provider,
461463 devdax_ipc_data -> offset , DEVDAX_PAGE_SIZE_2MB );
462464 }
463465
464- if (IS_NOT_ALIGNED (devdax_ipc_data -> length , DEVDAX_PAGE_SIZE_2MB )) {
465- LOG_WARN ("length (%zu) is not aligned to the page size (%zu)" ,
466- devdax_ipc_data -> length , DEVDAX_PAGE_SIZE_2MB );
467- }
468-
469466 LOG_PERR ("devdax mapping failed (path: %s, size: %zu, protection: %i, "
470467 "fd: %i, offset: %zu)" ,
471- devdax_ipc_data -> path , devdax_ipc_data -> length ,
468+ devdax_ipc_data -> path , length_aligned ,
472469 devdax_ipc_data -> protection , fd , devdax_ipc_data -> offset );
473470
474471 * ptr = NULL ;
@@ -479,7 +476,7 @@ static umf_result_t devdax_open_ipc_handle(void *provider,
479476
480477 LOG_DEBUG ("devdax mapped (path: %s, size: %zu, protection: %i, fd: %i, "
481478 "offset: %zu) to address %p" ,
482- devdax_ipc_data -> path , devdax_ipc_data -> length ,
479+ devdax_ipc_data -> path , length_aligned ,
483480 devdax_ipc_data -> protection , fd , devdax_ipc_data -> offset , addr );
484481
485482 * ptr = addr ;
@@ -495,17 +492,14 @@ static umf_result_t devdax_close_ipc_handle(void *provider, void *ptr,
495492 return UMF_RESULT_ERROR_INVALID_ARGUMENT ;
496493 }
497494
495+ size = ALIGN_UP (size , DEVDAX_PAGE_SIZE_2MB );
496+
498497 errno = 0 ;
499498 int ret = utils_munmap (ptr , size );
500499 // ignore error when size == 0
501500 if (ret && (size > 0 )) {
502501 devdax_store_last_native_error (UMF_DEVDAX_RESULT_ERROR_FREE_FAILED ,
503502 errno );
504- if (IS_NOT_ALIGNED (size , DEVDAX_PAGE_SIZE_2MB )) {
505- LOG_WARN ("size (%zu) is not aligned to the page size (%zu)" , size ,
506- DEVDAX_PAGE_SIZE_2MB );
507- }
508-
509503 LOG_PERR ("memory unmapping failed (ptr: %p, size: %zu)" , ptr , size );
510504
511505 return UMF_RESULT_ERROR_MEMORY_PROVIDER_SPECIFIC ;
0 commit comments