[Oisf-devel] [PATCH 4/6] Make runmode parse affinity settings.
Eric Leblond
eleblond at edenwall.com
Fri Nov 12 11:05:05 UTC 2010
This patch modifies runmode to parse configuration file related
to affinity settings. It also prepare the export of the
set_cpu_affinity which was previously local. It is now used
in the affinity and tm-threads files.
Signed-off-by: Eric Leblond <eleblond at edenwall.com>
---
src/runmodes.c | 7 ++++++-
src/runmodes.h | 3 +++
2 files changed, 9 insertions(+), 1 deletions(-)
diff --git a/src/runmodes.c b/src/runmodes.c
index fa8c5ff..d4131b1 100644
--- a/src/runmodes.c
+++ b/src/runmodes.c
@@ -33,6 +33,7 @@
#include "util-affinity.h"
#include "conf.h"
#include "queue.h"
+#include "runmodes.h"
#include "alert-fastlog.h"
#include "alert-prelude.h"
@@ -149,7 +150,6 @@ static void SetupOutputs(ThreadVars *tv)
}
}
-static int threading_set_cpu_affinity = FALSE;
static float threading_detect_ratio = 1;
/**
@@ -157,9 +157,14 @@ static float threading_detect_ratio = 1;
*/
static void RunModeInitialize(void)
{
+ threading_set_cpu_affinity = FALSE;
if ((ConfGetBool("threading.set_cpu_affinity", &threading_set_cpu_affinity)) == 0) {
threading_set_cpu_affinity = FALSE;
}
+ /* try to get custom cpu mask value if needed */
+ if (threading_set_cpu_affinity == TRUE) {
+ AffinitySetupLoadFromConfig();
+ }
if ((ConfGetFloat("threading.detect_thread_ratio", &threading_detect_ratio)) != 1) {
threading_detect_ratio = 1;
}
diff --git a/src/runmodes.h b/src/runmodes.h
index 3582712..fa8aa71 100644
--- a/src/runmodes.h
+++ b/src/runmodes.h
@@ -53,5 +53,8 @@ int RunModeErfDagAuto(DetectEngineCtx *, char *);
void RunModeShutDown(void);
int RunModeFilePcapAutoFp(DetectEngineCtx *de_ctx, char *file);
+
+
+int threading_set_cpu_affinity;
#endif /* __RUNMODES_H__ */
--
1.7.2.3
More information about the Oisf-devel
mailing list