]> git.ipfire.org Git - thirdparty/freeswitch.git/commitdiff
disable cpu timer affinity by default but make it still possible via config and fix...
authorAnthony Minessale <anthony.minessale@gmail.com>
Wed, 17 Feb 2010 19:50:25 +0000 (19:50 +0000)
committerAnthony Minessale <anthony.minessale@gmail.com>
Wed, 17 Feb 2010 19:50:25 +0000 (19:50 +0000)
git-svn-id: http://svn.freeswitch.org/svn/freeswitch/trunk@16679 d0543943-73ff-0310-b7d9-9358b9ac24b2

src/include/private/switch_core_pvt.h
src/switch_core.c
src/switch_time.c

index 5e292d98f39b8d3c0416596716d85222893335f2..d41250a8e29753e7ca790ca94bdef5752fdaf24e 100644 (file)
@@ -217,6 +217,7 @@ struct switch_runtime {
        uint32_t debug_level;
        uint32_t runlevel;
        uint32_t tipping_point;
+       uint32_t timer_affinity;
 };
 
 extern struct switch_runtime runtime;
index 826f3791867672b917006f5a71b54dc841073743..dfec0d1996780c41832956a894af71717c36551c 100644 (file)
@@ -1301,8 +1301,9 @@ SWITCH_DECLARE(switch_status_t) switch_core_init(switch_core_flag_t flags, switc
 
        runtime.running = 1;
        runtime.tipping_point = 1000000;
+       runtime.timer_affinity = -1;
        runtime.initiated = switch_time_now();
-
+       
        switch_scheduler_add_task(switch_epoch_time_now(NULL), heartbeat_callback, "heartbeat", "core", 0, NULL, SSHF_NONE | SSHF_NO_DEL);
 
        switch_uuid_get(&uuid);
@@ -1443,6 +1444,12 @@ static void switch_load_core_config(const char *file)
                                        switch_core_session_limit(atoi(val));
                                } else if (!strcasecmp(var, "tipping-point") && !zstr(val)) {
                                        runtime.tipping_point = atoi(val);
+                               } else if (!strcasecmp(var, "timer-affinity") && !zstr(val)) {
+                                       if (!strcasecmp(val, "disabled")) {
+                                               runtime.timer_affinity = -1;
+                                       } else {
+                                               runtime.timer_affinity = atoi(val);
+                                       }
                                } else if (!strcasecmp(var, "rtp-start-port") && !zstr(val)) {
                                        switch_rtp_set_start_port((switch_port_t) atoi(val));
                                } else if (!strcasecmp(var, "rtp-end-port") && !zstr(val)) {
index 9faa08ed69992781351a1af20c3bd248e3420ebb..4816a4c684a16b15d30168f824231cbfd790973f 100644 (file)
@@ -363,7 +363,7 @@ SWITCH_DECLARE(void) switch_sleep(switch_interval_time_t t)
 
 SWITCH_DECLARE(void) switch_cond_next(void)
 {
-       if (session_manager.session_count > 1000) {
+       if (session_manager.session_count > runtime.tipping_point) {
                os_yield();
                return;
        }
@@ -594,10 +594,12 @@ SWITCH_MODULE_RUNTIME_FUNCTION(softtimer_runtime)
        int fwd_errs = 0, rev_errs = 0;
 
 #ifdef HAVE_CPU_SET_MACROS
-       cpu_set_t set;
-       CPU_ZERO(&set);
-       CPU_SET(0, &set);
-       sched_setaffinity(0, sizeof(set), &set);
+       if (runtime.timer_affinity > -1) {
+               cpu_set_t set;
+               CPU_ZERO(&set);
+               CPU_SET(0, &set);
+               sched_setaffinity(runtime.timer_affinity, sizeof(set), &set);
+       }
 #endif
 
        switch_time_sync();