sched: Fix load corruption from update_cfs_shares()
commitf0d7442a5924a802b66eef79b3708f77297bfb35
authorPaul Turner <pjt@google.com>
Mon, 15 Nov 2010 23:47:03 +0000 (15 15:47 -0800)
committerIngo Molnar <mingo@elte.hu>
Thu, 18 Nov 2010 12:27:47 +0000 (18 13:27 +0100)
treeedffcb20dca3dfe7315b128dc8948977c7c27fa8
parent9e3081ca61147b29f52fddb4f7c6b6b82ea5eb7a
sched: Fix load corruption from update_cfs_shares()

As part of enqueue_entity both a new entity weight and its contribution to the
queuing cfs_rq / rq are updated.  Since update_cfs_shares will only update the
queueing weights when the entity is on_rq (which in this case it is not yet),
there's a dependency loop here:

update_cfs_shares needs account_entity_enqueue to update cfs_rq->load.weight
account_entity_enqueue needs the updated weight for the queuing cfs_rq load[*]

Fix this and avoid spurious dequeue/enqueues by issuing update_cfs_shares as
if we had accounted the enqueue already.

This was also resulting in rq->load corruption previously.

[*]: this dependency also exists when using the group cfs_rq w/
     update_cfs_shares as the weight of the enqueued entity changes
     without the load being updated.

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