mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
* [PATCH] cpu/hotplug: remove unused check_for_tasks() function
@ 2017-06-08  8:55 Arnd Bergmann
  2017-06-08  9:41 ` Sebastian Andrzej Siewior
  2017-06-12 17:04 ` [tip:smp/hotplug] cpu/hotplug: Remove " tip-bot for Arnd Bergmann
  0 siblings, 2 replies; 3+ messages in thread
From: Arnd Bergmann @ 2017-06-08  8:55 UTC (permalink / raw)
  To: Thomas Gleixner
  Cc: Peter Zijlstra, Arnd Bergmann, Ingo Molnar,
	Sebastian Andrzej Siewior, Anna-Maria Gleixner, Boris Ostrovsky,
	linux-kernel

clang -Wunused-function found one remaining function that was
apparently meant to be removed in a recent code cleanup:

kernel/cpu.c:565:20: warning: unused function 'check_for_tasks' [-Wunused-function]

Fixes: 530e9b76ae8f ("cpu/hotplug: Remove obsolete cpu hotplug register/unregister functions")
Signed-off-by: Arnd Bergmann <arnd@arndb.de>
---
 kernel/cpu.c | 24 ------------------------
 1 file changed, 24 deletions(-)

diff --git a/kernel/cpu.c b/kernel/cpu.c
index 7435ffc6163b..d0f5f54aa087 100644
--- a/kernel/cpu.c
+++ b/kernel/cpu.c
@@ -562,30 +562,6 @@ void clear_tasks_mm_cpumask(int cpu)
 	rcu_read_unlock();
 }
 
-static inline void check_for_tasks(int dead_cpu)
-{
-	struct task_struct *g, *p;
-
-	read_lock(&tasklist_lock);
-	for_each_process_thread(g, p) {
-		if (!p->on_rq)
-			continue;
-		/*
-		 * We do the check with unlocked task_rq(p)->lock.
-		 * Order the reading to do not warn about a task,
-		 * which was running on this cpu in the past, and
-		 * it's just been woken on another cpu.
-		 */
-		rmb();
-		if (task_cpu(p) != dead_cpu)
-			continue;
-
-		pr_warn("Task %s (pid=%d) is on cpu %d (state=%ld, flags=%x)\n",
-			p->comm, task_pid_nr(p), dead_cpu, p->state, p->flags);
-	}
-	read_unlock(&tasklist_lock);
-}
-
 /* Take this CPU down. */
 static int take_cpu_down(void *_param)
 {
-- 
2.9.0

^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: [PATCH] cpu/hotplug: remove unused check_for_tasks() function
  2017-06-08  8:55 [PATCH] cpu/hotplug: remove unused check_for_tasks() function Arnd Bergmann
@ 2017-06-08  9:41 ` Sebastian Andrzej Siewior
  2017-06-12 17:04 ` [tip:smp/hotplug] cpu/hotplug: Remove " tip-bot for Arnd Bergmann
  1 sibling, 0 replies; 3+ messages in thread
From: Sebastian Andrzej Siewior @ 2017-06-08  9:41 UTC (permalink / raw)
  To: Arnd Bergmann
  Cc: Thomas Gleixner, Peter Zijlstra, Ingo Molnar,
	Anna-Maria Gleixner, Boris Ostrovsky, linux-kernel

On 2017-06-08 10:55:33 [+0200], Arnd Bergmann wrote:
> clang -Wunused-function found one remaining function that was
> apparently meant to be removed in a recent code cleanup:
> 
> kernel/cpu.c:565:20: warning: unused function 'check_for_tasks' [-Wunused-function]

Oh, so we lost the check while we were removing the DEAD notifier. The
teardown part of CPUHP_AP_SCHED_STARTING (which came before that check)
does migrate_tasks() => select_fallback_rq() for each task on the CPU
and will BUG() if it can't move a task away (except for kernel threads).
So I think it should be safe remove that function.
 
> Fixes: 530e9b76ae8f ("cpu/hotplug: Remove obsolete cpu hotplug register/unregister functions")
> Signed-off-by: Arnd Bergmann <arnd@arndb.de>

Sebastian

^ permalink raw reply	[flat|nested] 3+ messages in thread

* [tip:smp/hotplug] cpu/hotplug: Remove unused check_for_tasks() function
  2017-06-08  8:55 [PATCH] cpu/hotplug: remove unused check_for_tasks() function Arnd Bergmann
  2017-06-08  9:41 ` Sebastian Andrzej Siewior
@ 2017-06-12 17:04 ` tip-bot for Arnd Bergmann
  1 sibling, 0 replies; 3+ messages in thread
From: tip-bot for Arnd Bergmann @ 2017-06-12 17:04 UTC (permalink / raw)
  To: linux-tip-commits
  Cc: mingo, hpa, linux-kernel, boris.ostrovsky, arnd, tglx, peterz,
	anna-maria, bigeasy

Commit-ID:  57de72125d34f83bfd39615fcc3cc25ca3b9c0ec
Gitweb:     http://git.kernel.org/tip/57de72125d34f83bfd39615fcc3cc25ca3b9c0ec
Author:     Arnd Bergmann <arnd@arndb.de>
AuthorDate: Thu, 8 Jun 2017 10:55:33 +0200
Committer:  Thomas Gleixner <tglx@linutronix.de>
CommitDate: Mon, 12 Jun 2017 19:00:55 +0200

cpu/hotplug: Remove unused check_for_tasks() function

clang -Wunused-function found one remaining function that was
apparently meant to be removed in a recent code cleanup:

kernel/cpu.c:565:20: warning: unused function 'check_for_tasks' [-Wunused-function]

Sebastian explained: The function became unused unintentionally, but there
is already a failure check, when a task cannot be removed from the outgoing
cpu in the scheduler code, so bringing it back is not really giving any
extra value.

Fixes: 530e9b76ae8f ("cpu/hotplug: Remove obsolete cpu hotplug register/unregister functions")
Signed-off-by: Arnd Bergmann <arnd@arndb.de>
Cc: Peter Zijlstra <peterz@infradead.org>
Cc: Sebastian Andrzej Siewior <bigeasy@linutronix.de>
Cc: Boris Ostrovsky <boris.ostrovsky@oracle.com>
Cc: Anna-Maria Gleixner <anna-maria@linutronix.de>
Link: http://lkml.kernel.org/r/20170608085544.2257132-1-arnd@arndb.de
Signed-off-by: Thomas Gleixner <tglx@linutronix.de>

---
 kernel/cpu.c | 24 ------------------------
 1 file changed, 24 deletions(-)

diff --git a/kernel/cpu.c b/kernel/cpu.c
index 7435ffc..d0f5f54 100644
--- a/kernel/cpu.c
+++ b/kernel/cpu.c
@@ -562,30 +562,6 @@ void clear_tasks_mm_cpumask(int cpu)
 	rcu_read_unlock();
 }
 
-static inline void check_for_tasks(int dead_cpu)
-{
-	struct task_struct *g, *p;
-
-	read_lock(&tasklist_lock);
-	for_each_process_thread(g, p) {
-		if (!p->on_rq)
-			continue;
-		/*
-		 * We do the check with unlocked task_rq(p)->lock.
-		 * Order the reading to do not warn about a task,
-		 * which was running on this cpu in the past, and
-		 * it's just been woken on another cpu.
-		 */
-		rmb();
-		if (task_cpu(p) != dead_cpu)
-			continue;
-
-		pr_warn("Task %s (pid=%d) is on cpu %d (state=%ld, flags=%x)\n",
-			p->comm, task_pid_nr(p), dead_cpu, p->state, p->flags);
-	}
-	read_unlock(&tasklist_lock);
-}
-
 /* Take this CPU down. */
 static int take_cpu_down(void *_param)
 {

^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2017-06-12 17:07 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2017-06-08  8:55 [PATCH] cpu/hotplug: remove unused check_for_tasks() function Arnd Bergmann
2017-06-08  9:41 ` Sebastian Andrzej Siewior
2017-06-12 17:04 ` [tip:smp/hotplug] cpu/hotplug: Remove " tip-bot for Arnd Bergmann

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox

all inboxes | Powered by JetHome®