Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > linux.kernel > #1394024

[PATCH] sched/nohz: fix affine unpinned timers mess

From Wanpeng Li <kernellwp@gmail.com>
Newsgroups linux.kernel
Subject [PATCH] sched/nohz: fix affine unpinned timers mess
Date 2016-05-04 08:50 +0200
Message-ID <ruYNc-7b5-7@gated-at.bofh.it> (permalink)
Organization linux.* mail to news gateway

Show all headers | View raw


From: Wanpeng Li <wanpeng.li@hotmail.com>

'commit 9642d18eee2c ("nohz: Affine unpinned timers to housekeepers")'
intended to affine unpinned timers to housekeepers:

unpinned timers(full dynaticks, idle)   =>   nearest busy housekeepers(otherwise, fallback to any housekeepers)
unpinned timers(full dynaticks, busy)   =>   nearest busy housekeepers(otherwise, fallback to any housekeepers)
unpinned timers(houserkeepers, idle)    =>   nearest busy housekeepers(otherwise, fallback to itself)

However, the !idle_cpu(i) && is_housekeeping_cpu(cpu) check modify the 
intention to:

unpinned timers(full dynaticks, idle)   =>   any housekeepers(no mattter cpu topology)
unpinned timers(full dynaticks, busy)   =>   any housekeepers(no mattter cpu topology)
unpinned timers(housekeepers, idle)     =>   any busy cpus(otherwise, fallback to any housekeepers)

This patch fix it by checking if there is busy housekeepers nearby,
otherwise fallback to any housekeepers/itself, after the patch:

unpinned timers(full dynaticks, idle)   =>   nearest busy housekeepers(otherwise, fallback to any housekeepers)
unpinned timers(full dynaticks, busy)   =>   nearest busy housekeepers(otherwise, fallback to any housekeepers)
unpinned timers(housekeepers, idle)     =>   nearest busy housekeepers(otherwise, fallback to itself)

Fixes: 'commit 9642d18eee2c ("nohz: Affine unpinned timers to housekeepers")' 
Cc: Frederic Weisbecker <fweisbec@gmail.com>
Cc: Peter Zijlstra <peterz@infradead.org>
Cc: Thomas Gleixner <tglx@linutronix.de> 
Cc: Ingo Molnar <mingo@kernel.org>
Signed-off-by: Wanpeng Li <wanpeng.li@hotmail.com>
---
 kernel/sched/core.c |    5 ++++-
 1 files changed, 4 insertions(+), 1 deletions(-)

diff --git a/kernel/sched/core.c b/kernel/sched/core.c
index adcafda..5538761 100644
--- a/kernel/sched/core.c
+++ b/kernel/sched/core.c
@@ -499,7 +499,10 @@ int get_nohz_timer_target(void)
 	rcu_read_lock();
 	for_each_domain(cpu, sd) {
 		for_each_cpu(i, sched_domain_span(sd)) {
-			if (!idle_cpu(i) && is_housekeeping_cpu(cpu)) {
+			if (cpu == i)
+				continue;
+
+			if (!idle_cpu(i) && is_housekeeping_cpu(i)) {
 				cpu = i;
 				goto unlock;
 			}
-- 
1.7.1

Back to linux.kernel | Previous | NextNext in thread | Find similar | Unroll thread


Thread

[PATCH] sched/nohz: fix affine unpinned timers mess Wanpeng Li <kernellwp@gmail.com> - 2016-05-04 08:50 +0200
  [tip:sched/core] sched/nohz: Fix affine unpinned timers mess tip-bot for Wanpeng Li <tipbot@zytor.com> - 2016-05-12 12:40 +0200

csiph-web