|
@@ -25,10 +25,13 @@
|
|
|
#include "dmm_config.h"
|
|
|
#include "dmmlib/dmmlib.h"
|
|
|
|
|
|
+#include "locks.h"
|
|
|
+
|
|
|
__attribute__((constructor)) void knobs_init(void);
|
|
|
|
|
|
/** Initializes the knobs structure of the system allocator. */
|
|
|
void knobs_init(void) {
|
|
|
+ lock_global();
|
|
|
systemallocator.dmm_knobs.sys_alloc_size = SYS_ALLOC_SIZE;
|
|
|
#ifdef GOOD_FIT
|
|
|
systemallocator.dmm_knobs.fitpercentage = GOOD_FIT_PERCENTAGE;
|
|
@@ -39,4 +42,24 @@ void knobs_init(void) {
|
|
|
#ifdef SPLITTING_VARIABLE
|
|
|
systemallocator.dmm_knobs.min_split_size = MIN_SPLITTING_SIZE;
|
|
|
#endif /* SPLITTING_VARIABLE */
|
|
|
+ unlock_global();
|
|
|
+}
|
|
|
+
|
|
|
+uint32_t dmm_set_knobs(dmm_knobs_t *conf);
|
|
|
+
|
|
|
+/** Sets the system allocator's knob structure. */
|
|
|
+uint32_t dmm_set_knobs(dmm_knobs_t *conf) {
|
|
|
+ lock_global();
|
|
|
+ systemallocator.dmm_knobs.sys_alloc_size = conf->sys_alloc_size;
|
|
|
+#ifdef GOOD_FIT
|
|
|
+ systemallocator.dmm_knobs.fitpercentage = conf->fitpercentage;
|
|
|
+#endif /* GOOD_FIT_PERCENTAGE */
|
|
|
+#ifdef COALESCING_VARIABLE
|
|
|
+ systemallocator.dmm_knobs.max_coalesce_size = conf->max_coalesce_size;
|
|
|
+#endif /* COALESCING_VARIABLE */
|
|
|
+#ifdef SPLITTING_VARIABLE
|
|
|
+ systemallocator.dmm_knobs.min_split_size = conf->min_split_size;
|
|
|
+#endif /* SPLITTING_VARIABLE */
|
|
|
+ unlock_global();
|
|
|
+ return 0;
|
|
|
}
|