From d08fa99f5a4a9d885788dfbc8655b5cb1b2779a7 Mon Sep 17 00:00:00 2001 From: mav Date: Fri, 9 Mar 2012 19:09:08 +0000 Subject: [PATCH 088/175] Make kern.sched.idlespinthresh default value adaptive depending of HZ. Otherwise with HZ above 8000 CPU may never skip timer ticks on idle. git-svn-id: http://svn.freebsd.org/base/head@232740 ccf9f872-aa2e-dd11-9fc8-001c23d0bc1f (cherry picked from commit 1985f32300307cc26964277fae540f31cd30a5b8) Signed-off-by: Xin Li --- sys/kern/sched_ule.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/sys/kern/sched_ule.c b/sys/kern/sched_ule.c index 8bd2f96..5fb15e3 100644 --- a/sys/kern/sched_ule.c +++ b/sys/kern/sched_ule.c @@ -212,7 +212,7 @@ static int preempt_thresh = 0; #endif static int static_boost = PRI_MIN_BATCH; static int sched_idlespins = 10000; -static int sched_idlespinthresh = 16; +static int sched_idlespinthresh = -1; /* * tdq - per processor runqs and statistics. All fields are protected by the @@ -1390,6 +1390,8 @@ sched_initticks(void *dummy) steal_thresh = min(fls(mp_ncpus) - 1, 3); affinity = SCHED_AFFINITY_DEFAULT; #endif + if (sched_idlespinthresh < 0) + sched_idlespinthresh = max(16, 2 * hz / realstathz); } -- 1.7.9.4