Skip to content

Commit

Permalink
sched: Fix/remove redundant cfs_rq checks
Browse files Browse the repository at this point in the history
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 <[email protected]>
Signed-off-by: Peter Zijlstra <[email protected]>
LKML-Reference: <[email protected]>
Signed-off-by: Ingo Molnar <[email protected]>
  • Loading branch information
paulturner authored and Ingo Molnar committed Jan 26, 2011
1 parent e37b6a7 commit b815f19
Showing 1 changed file with 1 addition and 4 deletions.
5 changes: 1 addition & 4 deletions kernel/sched_fair.c
Original file line number Diff line number Diff line change
Expand Up @@ -722,7 +722,7 @@ static void update_cfs_load(struct cfs_rq *cfs_rq, int global_update)
u64 now, delta;
unsigned long load = cfs_rq->load.weight;

if (!cfs_rq)
if (cfs_rq->tg == &root_task_group)
return;

now = rq_of(cfs_rq)->clock;
Expand Down Expand Up @@ -830,9 +830,6 @@ static void update_cfs_shares(struct cfs_rq *cfs_rq, long weight_delta)
struct sched_entity *se;
long shares;

if (!cfs_rq)
return;

tg = cfs_rq->tg;
se = tg->se[cpu_of(rq_of(cfs_rq))];
if (!se)
Expand Down

0 comments on commit b815f19

Please sign in to comment.