On Sat, 5 Jan 2013 16:37:45 +0800, Alex Shi wrote: > This patch add power aware scheduling in fork/exec/wake. It try to > select cpu from the busiest while still has utilization group. That's > will save power for other groups. > > The trade off is adding a power aware statistics collection in group > seeking. But since the collection just happened in power scheduling > eligible condition, the worst case of hackbench testing just drops > about 2% with powersaving/balance policy. No clear change for > performance policy. > > I had tried to use rq load avg utilisation in this balancing, but since > the utilisation need much time to accumulate itself. It's unfit for any > burst balancing. So I use nr_running as instant rq utilisation. > > Signed-off-by: Alex Shi <alex....@intel.com> > --- [snip] > +/* > + * Try to collect the task running number and capacity of the doamin. > + */ > +static void get_sd_power_stats(struct sched_domain *sd, > + struct task_struct *p, struct sd_lb_stats *sds) > +{ > + struct sched_group *group; > + struct sg_lb_stats sgs; > + int sd_min_delta = INT_MAX; > + int cpu = task_cpu(p); > + > + group = sd->groups; > + do { > + long g_delta; > + unsigned long threshold; > + > + if (!cpumask_test_cpu(cpu, sched_group_mask(group))) > + continue;
Why? That means only local group's stat will be accounted for this domain, right? Is it your intension? Thanks, Namhyung > + > + memset(&sgs, 0, sizeof(sgs)); > + get_sg_power_stats(group, sd, &sgs); > + > + if (sched_policy == SCHED_POLICY_POWERSAVING) > + threshold = sgs.group_weight; > + else > + threshold = sgs.group_capacity; > + > + g_delta = threshold - sgs.group_utils; > + > + if (g_delta > 0 && g_delta < sd_min_delta) { > + sd_min_delta = g_delta; > + sds->group_leader = group; > + } > + > + sds->sd_utils += sgs.group_utils; > + sds->total_pwr += group->sgp->power; > + } while (group = group->next, group != sd->groups); > + > + sds->sd_capacity = DIV_ROUND_CLOSEST(sds->total_pwr, > + SCHED_POWER_SCALE); > +} -- To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/