diff options
author | Paul Turner <pjt@google.com> | 2011-01-21 23:45:00 -0500 |
---|---|---|
committer | Ingo Molnar <mingo@elte.hu> | 2011-01-26 06:31:02 -0500 |
commit | b815f1963e47b9b69bb17e0588bd5af5b1114ae0 (patch) | |
tree | b7c087fbf80f0e46fabfc919c619827e73963592 /kernel | |
parent | e37b6a7b27b400c3aa488db8c6629a05095bc79c (diff) |
sched: Fix/remove redundant cfs_rq checks
Since updates are against an entity's queuing cfs_rq it's not possible to
enter update_cfs_{shares,load} with a NULL cfs_rq. (Indeed, update_cfs_load
would crash prior to the check if we did anyway since we load is examined
during the initializers).
Also, in the update_cfs_load case there's no point
in maintaining averages for rq->cfs_rq since we don't perform shares
distribution at that level -- NULL check is replaced accordingly.
Thanks to Dan Carpenter for pointing out the deference before NULL check.
Signed-off-by: Paul Turner <pjt@google.com>
Signed-off-by: Peter Zijlstra <a.p.zijlstra@chello.nl>
LKML-Reference: <20110122044851.825284940@google.com>
Signed-off-by: Ingo Molnar <mingo@elte.hu>
Diffstat (limited to 'kernel')
-rw-r--r-- | kernel/sched_fair.c | 5 |
1 files changed, 1 insertions, 4 deletions
diff --git a/kernel/sched_fair.c b/kernel/sched_fair.c index ccecfec02a70..1997383ba4d6 100644 --- a/kernel/sched_fair.c +++ b/kernel/sched_fair.c | |||
@@ -722,7 +722,7 @@ static void update_cfs_load(struct cfs_rq *cfs_rq, int global_update) | |||
722 | u64 now, delta; | 722 | u64 now, delta; |
723 | unsigned long load = cfs_rq->load.weight; | 723 | unsigned long load = cfs_rq->load.weight; |
724 | 724 | ||
725 | if (!cfs_rq) | 725 | if (cfs_rq->tg == &root_task_group) |
726 | return; | 726 | return; |
727 | 727 | ||
728 | now = rq_of(cfs_rq)->clock; | 728 | now = rq_of(cfs_rq)->clock; |
@@ -830,9 +830,6 @@ static void update_cfs_shares(struct cfs_rq *cfs_rq, long weight_delta) | |||
830 | struct sched_entity *se; | 830 | struct sched_entity *se; |
831 | long shares; | 831 | long shares; |
832 | 832 | ||
833 | if (!cfs_rq) | ||
834 | return; | ||
835 | |||
836 | tg = cfs_rq->tg; | 833 | tg = cfs_rq->tg; |
837 | se = tg->se[cpu_of(rq_of(cfs_rq))]; | 834 | se = tg->se[cpu_of(rq_of(cfs_rq))]; |
838 | if (!se) | 835 | if (!se) |