Logo AND Algorithmique Numérique Distribuée

Public GIT Repository
Add configuration parameter for contexts/guard_size.
authorArnaud Giersch <arnaud.giersch@iut-bm.univ-fcomte.fr>
Wed, 12 Mar 2014 13:47:33 +0000 (14:47 +0100)
committerArnaud Giersch <arnaud.giersch@iut-bm.univ-fcomte.fr>
Mon, 17 Mar 2014 10:53:58 +0000 (11:53 +0100)
include/simgrid/simix.h
src/simgrid/sg_config.c
src/simix/smx_context.c

index da13e26..02ef86d 100644 (file)
@@ -168,6 +168,8 @@ XBT_PUBLIC(smx_ctx_factory_initializer_t) smx_factory_initializer_to_use;
 extern char* smx_context_factory_name;
 extern int smx_context_stack_size;
 extern int smx_context_stack_size_was_set;
+extern int smx_context_guard_size;
+extern int smx_context_guard_size_was_set;
 
 /* *********************** */
 /* Context type definition */
index 64ebadd..fd2dfd2 100644 (file)
@@ -388,6 +388,12 @@ static void _sg_cfg_cb_context_stack_size(const char *name, int pos)
   smx_context_stack_size = xbt_cfg_get_int(_sg_cfg_set, name) * 1024;
 }
 
+static void _sg_cfg_cb_context_guard_size(const char *name, int pos)
+{
+  smx_context_guard_size_was_set = 1;
+  smx_context_guard_size = xbt_cfg_get_int(_sg_cfg_set, name) * xbt_pagesize;
+}
+
 static void _sg_cfg_cb_contexts_nthreads(const char *name, int pos)
 {
   SIMIX_context_set_nthreads(xbt_cfg_get_int(_sg_cfg_set, name));
@@ -658,6 +664,14 @@ void sg_config_init(int *argc, char **argv)
     /* No, it was not set yet (the above setdefault() changed this to 1). */
     smx_context_stack_size_was_set = 0;
 
+    /* guard size for contexts stacks in memory pages */
+    xbt_cfg_register(&_sg_cfg_set, "contexts/guard_size",
+                     "Guard size for contexts stacks in memory pages",
+                     xbt_cfgelm_int, 1, 1, _sg_cfg_cb_context_guard_size, NULL);
+    xbt_cfg_setdefault_int(_sg_cfg_set, "contexts/guard_size", 1);
+    /* No, it was not set yet (the above setdefault() changed this to 1). */
+    smx_context_guard_size_was_set = 0;
+
     /* number of parallel threads for user processes */
     xbt_cfg_register(&_sg_cfg_set, "contexts/nthreads",
                      "Number of parallel threads used to execute user contexts",
index 57d84e2..662f382 100644 (file)
@@ -25,6 +25,8 @@ char* smx_context_factory_name = NULL; /* factory name specified by --cfg=contex
 smx_ctx_factory_initializer_t smx_factory_initializer_to_use = NULL;
 int smx_context_stack_size;
 int smx_context_stack_size_was_set = 0;
+int smx_context_guard_size;
+int smx_context_guard_size_was_set = 0;
 #ifdef HAVE_THREAD_LOCAL_STORAGE
 static __thread smx_context_t smx_current_context_parallel;
 #else