20
20
#include "base_alloc_global.h"
21
21
#include "coarse.h"
22
22
#include "libumf.h"
23
+ #include "memory_pool_internal.h"
23
24
#include "utils_common.h"
24
25
#include "utils_concurrency.h"
25
26
#include "utils_log.h"
@@ -34,6 +35,8 @@ typedef struct fixed_memory_provider_t {
34
35
35
36
// used only when the UMF_FIXED_FLAG_CREATE_FROM_POOL_PTR flag is set
36
37
size_t ptr_orig_size ; // original size of the memory region in the tracker
38
+ umf_memory_provider_handle_t
39
+ trackingProvider ; // tracking provider of the original memory pool
37
40
} fixed_memory_provider_t ;
38
41
39
42
// Fixed Memory provider settings struct
@@ -89,6 +92,7 @@ static umf_result_t fixed_allocation_merge_cb(void *provider, void *lowPtr,
89
92
static umf_result_t fixed_initialize (void * params , void * * provider ) {
90
93
umf_result_t ret ;
91
94
size_t ptr_orig_size = 0 ;
95
+ umf_memory_provider_handle_t trackingProvider = NULL ;
92
96
93
97
if (params == NULL ) {
94
98
return UMF_RESULT_ERROR_INVALID_ARGUMENT ;
@@ -104,6 +108,12 @@ static umf_result_t fixed_initialize(void *params, void **provider) {
104
108
"the given pointer does not belong to any UMF pool" );
105
109
return UMF_RESULT_ERROR_INVALID_ARGUMENT ;
106
110
}
111
+
112
+ ret = umfPoolGetTrackingProvider (pool , & trackingProvider );
113
+ if (ret != UMF_RESULT_SUCCESS ) {
114
+ LOG_ERR ("cannot get the tracking provider of the pool %p" , pool );
115
+ return ret ;
116
+ }
107
117
}
108
118
109
119
fixed_memory_provider_t * fixed_provider =
@@ -139,6 +149,7 @@ static umf_result_t fixed_initialize(void *params, void **provider) {
139
149
fixed_provider -> size = in_params -> size ;
140
150
fixed_provider -> flags = in_params -> flags ;
141
151
fixed_provider -> ptr_orig_size = ptr_orig_size ;
152
+ fixed_provider -> trackingProvider = trackingProvider ;
142
153
143
154
// add the entire memory as a single block
144
155
ret = coarse_add_memory_fixed (coarse , fixed_provider -> base ,
0 commit comments