public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
* [PATCH v2] sched: Remove unlikely annotation from sched_move_task() running check
@ 2017-02-06 16:04 Steven Rostedt
  2017-02-10  8:33 ` [tip:sched/core] sched/core: Remove unlikely() annotation from sched_move_task() tip-bot for Steven Rostedt (VMware)
  0 siblings, 1 reply; 2+ messages in thread
From: Steven Rostedt @ 2017-02-06 16:04 UTC (permalink / raw)
  To: LKML, Peter Zijlstra
  Cc: Ingo Molnar, Andrew Morton, Oleg Nesterov, Vincent Guittot

From: "Steven Rostedt (VMware)" <rostedt@goodmis.org>

The check for running in sched_move_task() has an unlikely() around it. That
is, it is unlikely that the task being moved is running. That use to be
true. But with a couple of recent updates, it is now likely that the task
will be running.

The first change came from ea86cb4b7621 ("sched/cgroup: Fix
cpu_cgroup_fork() handling") that moved around the use case of
sched_move_task() in do_fork() where the call is now done after the task is
woken (hence it is running).

The second change came from 8e5bfa8c1f84 ("sched/autogroup: Do not use
autogroup->tg in zombie threads") where sched_move_task() is called by the
exit path, by the task that is exiting. Hence it too is running.

Cc: Oleg Nesterov <oleg@redhat.com>
Cc: Vincent Guittot <vincent.guittot@linaro.org>
Signed-off-by: Steven Rostedt (VMware) <rostedt@goodmis.org>
---
Changes from v1.

 Removed annotation entirely, instead of inversing it.

 Changed the subject from:

  sched: Update unlikely to now likely in sched_move_task()

 kernel/sched/core.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/kernel/sched/core.c b/kernel/sched/core.c
index c56fb57..dbb295f 100644
--- a/kernel/sched/core.c
+++ b/kernel/sched/core.c
@@ -7989,14 +7989,14 @@ void sched_move_task(struct task_struct *tsk)
 
 	if (queued)
 		dequeue_task(rq, tsk, DEQUEUE_SAVE | DEQUEUE_MOVE);
-	if (unlikely(running))
+	if (running)
 		put_prev_task(rq, tsk);
 
 	sched_change_group(tsk, TASK_MOVE_GROUP);
 
 	if (queued)
 		enqueue_task(rq, tsk, ENQUEUE_RESTORE | ENQUEUE_MOVE);
-	if (unlikely(running))
+	if (running)
 		set_curr_task(rq, tsk);
 
 	task_rq_unlock(rq, tsk, &rf);
-- 
2.9.3

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

* [tip:sched/core] sched/core: Remove unlikely() annotation from sched_move_task()
  2017-02-06 16:04 [PATCH v2] sched: Remove unlikely annotation from sched_move_task() running check Steven Rostedt
@ 2017-02-10  8:33 ` tip-bot for Steven Rostedt (VMware)
  0 siblings, 0 replies; 2+ messages in thread
From: tip-bot for Steven Rostedt (VMware) @ 2017-02-10  8:33 UTC (permalink / raw)
  To: linux-tip-commits
  Cc: torvalds, oleg, peterz, vincent.guittot, tglx, rostedt,
	linux-kernel, akpm, hpa, mingo

Commit-ID:  bb3bac2ca9a3a5b7fa601781adf70167a0449d75
Gitweb:     http://git.kernel.org/tip/bb3bac2ca9a3a5b7fa601781adf70167a0449d75
Author:     Steven Rostedt (VMware) <rostedt@goodmis.org>
AuthorDate: Mon, 6 Feb 2017 11:04:26 -0500
Committer:  Ingo Molnar <mingo@kernel.org>
CommitDate: Fri, 10 Feb 2017 09:05:42 +0100

sched/core: Remove unlikely() annotation from sched_move_task()

The check for 'running' in sched_move_task() has an unlikely() around it. That
is, it is unlikely that the task being moved is running. That use to be
true. But with a couple of recent updates, it is now likely that the task
will be running.

The first change came from ea86cb4b7621 ("sched/cgroup: Fix
cpu_cgroup_fork() handling") that moved around the use case of
sched_move_task() in do_fork() where the call is now done after the task is
woken (hence it is running).

The second change came from 8e5bfa8c1f84 ("sched/autogroup: Do not use
autogroup->tg in zombie threads") where sched_move_task() is called by the
exit path, by the task that is exiting. Hence it too is running.

Signed-off-by: Steven Rostedt (VMware) <rostedt@goodmis.org>
Signed-off-by: Peter Zijlstra (Intel) <peterz@infradead.org>
Cc: Andrew Morton <akpm@linux-foundation.org>
Cc: Linus Torvalds <torvalds@linux-foundation.org>
Cc: Oleg Nesterov <oleg@redhat.com>
Cc: Peter Zijlstra <peterz@infradead.org>
Cc: Thomas Gleixner <tglx@linutronix.de>
Cc: Vincent Guittot <vincent.guittot@linaro.org>
Link: http://lkml.kernel.org/r/20170206110426.27ca6426@gandalf.local.home
Signed-off-by: Ingo Molnar <mingo@kernel.org>
---
 kernel/sched/core.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/kernel/sched/core.c b/kernel/sched/core.c
index e4aa470..34e2291 100644
--- a/kernel/sched/core.c
+++ b/kernel/sched/core.c
@@ -6404,14 +6404,14 @@ void sched_move_task(struct task_struct *tsk)
 
 	if (queued)
 		dequeue_task(rq, tsk, DEQUEUE_SAVE | DEQUEUE_MOVE);
-	if (unlikely(running))
+	if (running)
 		put_prev_task(rq, tsk);
 
 	sched_change_group(tsk, TASK_MOVE_GROUP);
 
 	if (queued)
 		enqueue_task(rq, tsk, ENQUEUE_RESTORE | ENQUEUE_MOVE);
-	if (unlikely(running))
+	if (running)
 		set_curr_task(rq, tsk);
 
 	task_rq_unlock(rq, tsk, &rf);

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

end of thread, other threads:[~2017-02-10  8:35 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2017-02-06 16:04 [PATCH v2] sched: Remove unlikely annotation from sched_move_task() running check Steven Rostedt
2017-02-10  8:33 ` [tip:sched/core] sched/core: Remove unlikely() annotation from sched_move_task() tip-bot for Steven Rostedt (VMware)

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