@@ -129,6 +129,14 @@ static void *(*prev_malloc_hook)(size_t, const void *);
129
129
* memalign which will be called through __malloc_hook instead of malloc.
130
130
*/
131
131
static void * _opal_memory_linux_malloc_align_hook (size_t sz , const void * caller );
132
+
133
+ static mca_base_var_enum_value_t align_values [] = {
134
+ {-1 , "disabled" },
135
+ {0 , "0" },
136
+ {32 , "32" },
137
+ {64 , "64" },
138
+ {0 , NULL }
139
+ };
132
140
#endif /* MEMORY_LINUX_MALLOC_ALIGN_ENABLED */
133
141
134
142
@@ -137,6 +145,9 @@ static void *_opal_memory_linux_malloc_align_hook(size_t sz, const void* caller)
137
145
*/
138
146
static int linux_register (void )
139
147
{
148
+ #if MEMORY_LINUX_MALLOC_ALIGN_ENABLED
149
+ mca_base_var_enum_t * new_enum ;
150
+ #endif
140
151
int ret ;
141
152
/* Information only */
142
153
ret = mca_base_component_var_register (& mca_memory_linux_component .super .memoryc_version ,
@@ -199,17 +210,19 @@ static int linux_register(void)
199
210
}
200
211
201
212
#if MEMORY_LINUX_MALLOC_ALIGN_ENABLED
213
+ (void )mca_base_var_enum_create ("memory_linux_memalign" , align_values , & new_enum );
202
214
mca_memory_linux_component .use_memalign = -1 ;
203
215
ret = mca_base_component_var_register (& mca_memory_linux_component .super .memoryc_version ,
204
216
"memalign" ,
205
- "[64 | 32 | 0] - Enable memory alignment for all malloc calls (default: disabled) ." ,
217
+ "[64 | 32 | 0] - Enable memory alignment for all malloc calls." ,
206
218
MCA_BASE_VAR_TYPE_INT ,
207
- NULL ,
219
+ new_enum ,
208
220
0 ,
209
221
0 ,
210
222
OPAL_INFO_LVL_5 ,
211
223
MCA_BASE_VAR_SCOPE_READONLY ,
212
224
& mca_memory_linux_component .use_memalign );
225
+ OBJ_RELEASE (new_enum );
213
226
if (0 > ret ) {
214
227
return ret ;
215
228
}
@@ -230,16 +243,6 @@ static int linux_register(void)
230
243
if (0 > ret ) {
231
244
return ret ;
232
245
}
233
-
234
- if (mca_memory_linux_component .use_memalign != -1
235
- && mca_memory_linux_component .use_memalign != 32
236
- && mca_memory_linux_component .use_memalign != 64
237
- && mca_memory_linux_component .use_memalign != 0 ){
238
- opal_show_help ("help-opal-memory-linux.txt" , "invalid mca param value" ,
239
- true, "Wrong memalign parameter value. Allowed values: 64, 32, 0." ,
240
- "memory_linux_memalign is reset to 32" );
241
- mca_memory_linux_component .use_memalign = 32 ;
242
- }
243
246
#endif /* MEMORY_LINUX_MALLOC_ALIGN_ENABLED */
244
247
245
248
return (0 > ret ) ? ret : OPAL_SUCCESS ;
0 commit comments