27
27
28
28
#include "opal/mca/mca.h"
29
29
#include "opal/mca/base/base.h"
30
+ #include "opal/mca/base/mca_base_pvar.h"
30
31
#include "opal/mca/rcache/rcache.h"
31
32
#include "opal/mca/rcache/base/base.h"
32
33
#include "opal/memoryhooks/memory.h"
33
34
#include "opal/constants.h"
34
35
#include "rcache_base_mem_cb.h"
35
36
37
+ /* two-level macro for stringifying a number */
38
+ #define STRINGIFYX (x ) #x
39
+ #define STRINGIFY (x ) STRINGIFYX(x)
40
+
36
41
/*
37
42
* The following file was created by configure. It contains extern
38
43
* statements and the definition of an array of pointers to each
@@ -59,12 +64,19 @@ static void mca_rcache_base_registration_constructor( mca_rcache_base_registrati
59
64
OBJ_CLASS_INSTANCE (mca_rcache_base_registration_t , opal_free_list_item_t ,
60
65
mca_rcache_base_registration_constructor , NULL );
61
66
67
+ #define TREE_ITEMS_MIN 2048
68
+ #define TREE_ITEMS_MAX 16384
69
+ #define TREE_ITEMS_INC 2048
62
70
63
71
/*
64
72
* Global variables
65
73
*/
66
74
opal_list_t mca_rcache_base_modules = {{0 }};
67
-
75
+ opal_free_list_t mca_rcache_base_vma_tree_items = {{0 }};
76
+ bool mca_rcache_base_vma_tree_items_inited = false;
77
+ unsigned int mca_rcache_base_vma_tree_items_min = TREE_ITEMS_MIN ;
78
+ int mca_rcache_base_vma_tree_items_max = TREE_ITEMS_MAX ;
79
+ unsigned int mca_rcache_base_vma_tree_items_inc = TREE_ITEMS_INC ;
68
80
69
81
OBJ_CLASS_INSTANCE (mca_rcache_base_selected_module_t , opal_list_item_t , NULL , NULL );
70
82
@@ -100,8 +112,11 @@ static int mca_rcache_base_close(void)
100
112
time between now and end of application (even post main()!) */
101
113
(void ) mca_base_framework_close (& opal_memory_base_framework );
102
114
}
103
- /* All done */
104
115
116
+ OBJ_DESTRUCT (& mca_rcache_base_vma_tree_items );
117
+ mca_rcache_base_vma_tree_items_inited = false;
118
+
119
+ /* All done */
105
120
/* Close all remaining available components */
106
121
return mca_base_framework_components_close (& opal_rcache_base_framework , NULL );
107
122
}
@@ -117,11 +132,42 @@ static int mca_rcache_base_open(mca_base_open_flag_t flags)
117
132
118
133
OBJ_CONSTRUCT (& mca_rcache_base_modules , opal_list_t );
119
134
135
+ /* the free list is only initialized when a VMA tree is created */
136
+ OBJ_CONSTRUCT (& mca_rcache_base_vma_tree_items , opal_free_list_t );
137
+
120
138
/* Open up all available components */
121
139
return mca_base_framework_components_open (& opal_rcache_base_framework , flags );
122
140
}
123
141
124
- MCA_BASE_FRAMEWORK_DECLARE (opal , rcache , "OPAL Registration Cache" , NULL ,
142
+ static int mca_rcache_base_register_mca_variables (mca_base_register_flag_t flags )
143
+ {
144
+
145
+ mca_rcache_base_vma_tree_items_min = TREE_ITEMS_MIN ;
146
+ (void ) mca_base_framework_var_register (& opal_rcache_base_framework , "vma_tree_items_min" ,
147
+ "Minimum number of VMA tree items to allocate (default: "
148
+ STRINGIFY (TREE_ITEMS_MIN ) ")" , MCA_BASE_VAR_TYPE_UNSIGNED_INT ,
149
+ NULL , MCA_BASE_VAR_BIND_NO_OBJECT , 0 , OPAL_INFO_LVL_6 ,
150
+ MCA_BASE_VAR_SCOPE_READONLY , & mca_rcache_base_vma_tree_items_min );
151
+
152
+ mca_rcache_base_vma_tree_items_max = TREE_ITEMS_MAX ;
153
+ (void ) mca_base_framework_var_register (& opal_rcache_base_framework , "vma_tree_items_max" ,
154
+ "Maximum number of VMA tree items to allocate (default: "
155
+ STRINGIFY (TREE_ITEMS_MAX ) ", -1: unlimited)" , MCA_BASE_VAR_TYPE_INT ,
156
+ NULL , MCA_BASE_VAR_BIND_NO_OBJECT , 0 , OPAL_INFO_LVL_6 ,
157
+ MCA_BASE_VAR_SCOPE_READONLY , & mca_rcache_base_vma_tree_items_max );
158
+
159
+ mca_rcache_base_vma_tree_items_inc = TREE_ITEMS_INC ;
160
+ (void ) mca_base_framework_var_register (& opal_rcache_base_framework , "vma_tree_items_inc" ,
161
+ "Number of VMA tree items to allocate at a time (default: "
162
+ STRINGIFY (TREE_ITEMS_INC ) ")" , MCA_BASE_VAR_TYPE_UNSIGNED_INT ,
163
+ NULL , MCA_BASE_VAR_BIND_NO_OBJECT , 0 , OPAL_INFO_LVL_6 ,
164
+ MCA_BASE_VAR_SCOPE_READONLY , & mca_rcache_base_vma_tree_items_inc );
165
+
166
+ return OPAL_SUCCESS ;
167
+ }
168
+
169
+ MCA_BASE_FRAMEWORK_DECLARE (opal , rcache , "OPAL Registration Cache" ,
170
+ mca_rcache_base_register_mca_variables ,
125
171
mca_rcache_base_open , mca_rcache_base_close ,
126
172
mca_rcache_base_static_components , 0 );
127
173
0 commit comments