sched: Avoid expensive initial update_cfs_load()
commitf07333bf6ee66d9b49286cec4371cf375e745b7a
authorPaul Turner <pjt@google.com>
Sat, 22 Jan 2011 04:45:03 +0000 (21 20:45 -0800)
committerIngo Molnar <mingo@elte.hu>
Wed, 26 Jan 2011 11:33:19 +0000 (26 12:33 +0100)
tree03a1e9968eadf2465b6fc04fb8c1ab67327ea0f2
parent6d5ab2932a21ea54406ab95c43ecff90a3eddfda
sched: Avoid expensive initial update_cfs_load()

Since cfs->{load_stamp,load_last} are zero-initalized the initial load update
will consider the delta to be 'since the beginning of time'.

This results in a lot of pointless divisions to bring this large period to be
within the sysctl_sched_shares_window.

Fix this by initializing load_stamp to be 1 at cfs_rq initialization, this
allows for an initial load_stamp > load_last which then lets standard idle
truncation proceed.

We avoid spinning (and slightly improve consistency) by fixing delta to be
[period - 1] in this path resulting in a slightly more predictable shares ramp.
(Previously the amount of idle time preserved by the overflow would range between
[period/2,period-1].)

Signed-off-by: Paul Turner <pjt@google.com>
Signed-off-by: Peter Zijlstra <a.p.zijlstra@chello.nl>
LKML-Reference: <20110122044852.102126037@google.com>
Signed-off-by: Ingo Molnar <mingo@elte.hu>
kernel/sched.c
kernel/sched_fair.c