sched/fair: Unify switched_{from,to}_fair() and task_move_group_fair()
authorByungchul Park <byungchul.park@lge.com>
Thu, 20 Aug 2015 11:22:00 +0000 (20:22 +0900)
committerIngo Molnar <mingo@kernel.org>
Sun, 13 Sep 2015 07:52:49 +0000 (09:52 +0200)
commitdaa59407b558e6e621e9081a308d5db3ef991fb6
tree2d10020451419257fb46929880240fe68c66929d
parenta9280514bf1e54775b8d7cd93d87c05c2b5273e6
sched/fair: Unify switched_{from,to}_fair() and task_move_group_fair()

By observing that switched_from_fair() detaches from a runqueue, and
switched_to_fair() attaches to a runqueue, we can see that
task_move_group_fair() is one followed by the other with flipping the
runqueue in between.

Therefore extract all the common bits and implement all three
functions in terms of them.

This should fix a few corner cases wrt. vruntime normalization; where,
when we take a task off of a runqueue we convert to an approximation
of lag by subtracting min_vruntime, and when placing a task on the a
runqueue to the reverse.

Suggested-by: Peter Zijlstra <peterz@infradead.org>
Signed-off-by: Byungchul Park <byungchul.park@lge.com>
[peterz: Changelog]
Signed-off-by: Peter Zijlstra (Intel) <peterz@infradead.org>
Cc: Linus Torvalds <torvalds@linux-foundation.org>
Cc: Mike Galbraith <efault@gmx.de>
Cc: Thomas Gleixner <tglx@linutronix.de>
Cc: yuyang.du@intel.com
Link: http://lkml.kernel.org/r/1440069720-27038-6-git-send-email-byungchul.park@lge.com
Signed-off-by: Ingo Molnar <mingo@kernel.org>
kernel/sched/fair.c