lkml.org 
[lkml]   [2013]   [Jan]   [14]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
/
From
SubjectRe: [PATCH v3 16/22] sched: add power aware scheduling in fork/exec/wake
Date
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.shi@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);
> +}


\
 
 \ /
  Last update: 2013-01-14 08:42    [W:0.275 / U:2.712 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site