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


Groups > linux.kernel > #1394024 > unrolled thread

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

Started byWanpeng Li <kernellwp@gmail.com>
First post2016-05-04 08:50 +0200
Last post2016-05-12 12:40 +0200
Articles 2 — 2 participants

Back to article view | Back to linux.kernel


Contents

  [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

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

FromWanpeng Li <kernellwp@gmail.com>
Date2016-05-04 08:50 +0200
Subject[PATCH] sched/nohz: fix affine unpinned timers mess
Message-ID<ruYNc-7b5-7@gated-at.bofh.it>
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

[toc] | [next] | [standalone]


#1399895 — [tip:sched/core] sched/nohz: Fix affine unpinned timers mess

Fromtip-bot for Wanpeng Li <tipbot@zytor.com>
Date2016-05-12 12:40 +0200
Subject[tip:sched/core] sched/nohz: Fix affine unpinned timers mess
Message-ID<rxWca-3K2-15@gated-at.bofh.it>
In reply to#1394024
Commit-ID:  444969223c81c7d0a95136b7b4cfdcfbc96ac5bd
Gitweb:     http://git.kernel.org/tip/444969223c81c7d0a95136b7b4cfdcfbc96ac5bd
Author:     Wanpeng Li <wanpeng.li@hotmail.com>
AuthorDate: Wed, 4 May 2016 14:45:34 +0800
Committer:  Ingo Molnar <mingo@kernel.org>
CommitDate: Thu, 12 May 2016 09:55:32 +0200

sched/nohz: Fix affine unpinned timers mess

The following 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 modified 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 fixes it by checking if there are busy housekeepers nearby,
otherwise falls 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)

Signed-off-by: Wanpeng Li <wanpeng.li@hotmail.com>
Signed-off-by: Peter Zijlstra (Intel) <peterz@infradead.org>
[ Fixed the changelog. ]
Cc: Frederic Weisbecker <fweisbec@gmail.com>
Cc: Linus Torvalds <torvalds@linux-foundation.org>
Cc: Mike Galbraith <efault@gmx.de>
Cc: Peter Zijlstra <peterz@infradead.org>
Cc: Thomas Gleixner <tglx@linutronix.de>
Cc: linux-kernel@vger.kernel.org
Fixes: 'commit 9642d18eee2c ("nohz: Affine unpinned timers to housekeepers")'
Link: http://lkml.kernel.org/r/1462344334-8303-1-git-send-email-wanpeng.li@hotmail.com
Signed-off-by: Ingo Molnar <mingo@kernel.org>
---
 kernel/sched/core.c | 5 ++++-
 1 file changed, 4 insertions(+), 1 deletion(-)

diff --git a/kernel/sched/core.c b/kernel/sched/core.c
index 636c4b9..6f6962a 100644
--- a/kernel/sched/core.c
+++ b/kernel/sched/core.c
@@ -533,7 +533,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;
 			}

[toc] | [prev] | [standalone]


Back to top | Article view | linux.kernel


csiph-web