[Oisf-devel] [PATCH] add management cpu set

Eric Leblond eleblond at edenwall.com
Fri Nov 12 16:56:18 UTC 2010


This patch adds support for a new thread family "management_cpu_set".
All threads created via TmThreadCreateMgmtThread() are assigned to
this family.

Signed-off-by: Eric Leblond <eleblond at edenwall.com>
---
 src/tm-threads.c    |    2 ++
 src/util-affinity.c |    7 +++++++
 src/util-affinity.h |    1 +
 suricata.yaml       |    2 ++
 4 files changed, 12 insertions(+), 0 deletions(-)

diff --git a/src/tm-threads.c b/src/tm-threads.c
index 4f88c69..adcbd1f 100644
--- a/src/tm-threads.c
+++ b/src/tm-threads.c
@@ -967,6 +967,8 @@ ThreadVars *TmThreadCreateMgmtThread(char *name, void *(fn_p)(void *),
 
     tv = TmThreadCreate(name, NULL, NULL, NULL, NULL, "custom", fn_p, mucond);
 
+    TmThreadSetCPU(tv, MANAGEMENT_CPU_SET);
+
     if (tv != NULL)
         tv->type = TVT_MGMT;
 
diff --git a/src/util-affinity.c b/src/util-affinity.c
index f4b53dd..c27de4e 100644
--- a/src/util-affinity.c
+++ b/src/util-affinity.c
@@ -68,6 +68,13 @@ ThreadsAffinityType thread_affinity[MAX_CPU_SET] = {
         .prio = PRIO_MEDIUM,
         .lcpu = 0,
     },
+    {
+        .name = "management_cpu_set",
+        .mode_flag = BALANCED_AFFINITY,
+        .prio = PRIO_MEDIUM,
+        .lcpu = 0,
+    },
+
 };
 
 /**
diff --git a/src/util-affinity.h b/src/util-affinity.h
index 14d64fb..26670fb 100644
--- a/src/util-affinity.h
+++ b/src/util-affinity.h
@@ -32,6 +32,7 @@ enum {
     DETECT_CPU_SET,
     VERDICT_CPU_SET,
     OUTPUT_CPU_SET,
+    MANAGEMENT_CPU_SET,
     MAX_CPU_SET
 };
 
diff --git a/suricata.yaml b/suricata.yaml
index 1c5d129..ed23eaa 100644
--- a/suricata.yaml
+++ b/suricata.yaml
@@ -136,6 +136,8 @@ threading:
   # Tune cpu affinity of suricata threads. Each family of threads can be bound
   # on specific CPUs.
   cpu_affinity:
+    - management_cpu_set:
+        cpu: [ 0 ]  # include only these cpus in affinity settings
     - receive_cpu_set:
         cpu: [ 0 ]  # include only these cpus in affinity settings
     - decode_cpu_set:
-- 
1.7.2.3




More information about the Oisf-devel mailing list