Skip to content

Commit

Permalink
sched: Optimize unused cgroup configuration
Browse files Browse the repository at this point in the history
When cgroup group scheduling is built in, skip some code paths
if we don't have any (but the root) cgroups configured.

Signed-off-by: Peter Zijlstra <a.p.zijlstra@chello.nl>
Signed-off-by: Ingo Molnar <mingo@elte.hu>
  • Loading branch information
Peter Zijlstra authored and Ingo Molnar committed Aug 2, 2009
1 parent a500427 commit e709715
Showing 1 changed file with 14 additions and 2 deletions.
16 changes: 14 additions & 2 deletions kernel/sched.c
Original file line number Diff line number Diff line change
Expand Up @@ -1629,8 +1629,14 @@ static int tg_load_down(struct task_group *tg, void *data)

static void update_shares(struct sched_domain *sd)
{
u64 now = cpu_clock(raw_smp_processor_id());
s64 elapsed = now - sd->last_update;
s64 elapsed;
u64 now;

if (root_task_group_empty())
return;

now = cpu_clock(raw_smp_processor_id());
elapsed = now - sd->last_update;

if (elapsed >= (s64)(u64)sysctl_sched_shares_ratelimit) {
sd->last_update = now;
Expand All @@ -1640,13 +1646,19 @@ static void update_shares(struct sched_domain *sd)

static void update_shares_locked(struct rq *rq, struct sched_domain *sd)
{
if (root_task_group_empty())
return;

spin_unlock(&rq->lock);
update_shares(sd);
spin_lock(&rq->lock);
}

static void update_h_load(long cpu)
{
if (root_task_group_empty())
return;

walk_tg_tree(tg_load_down, tg_nop, (void *)cpu);
}

Expand Down

0 comments on commit e709715

Please sign in to comment.