sched/core: Remove unlikely() annotation from sched_move_task()
authorSteven Rostedt (VMware) <[email protected]>
Mon, 6 Feb 2017 16:04:26 +0000 (11:04 -0500)
committerIngo Molnar <[email protected]>
Fri, 10 Feb 2017 08:05:42 +0000 (09:05 +0100)
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) <[email protected]>
Signed-off-by: Peter Zijlstra (Intel) <[email protected]>
Cc: Andrew Morton <[email protected]>
Cc: Linus Torvalds <[email protected]>
Cc: Oleg Nesterov <[email protected]>
Cc: Peter Zijlstra <[email protected]>
Cc: Thomas Gleixner <[email protected]>
Cc: Vincent Guittot <[email protected]>
Link: http://lkml.kernel.org/r/[email protected]
Signed-off-by: Ingo Molnar <[email protected]>
kernel/sched/core.c

index e4aa470ed45435ef3b4ad3f74b435d5ce8cf7c6d..34e2291a9a6c163be3dfd774ed110bf07ab0e890 100644 (file)
@@ -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);