[<prev] [next>] [day] [month] [year] [list]
Message-ID: <55428DEF.7080801@arm.com>
Date: Thu, 30 Apr 2015 21:17:51 +0100
From: Dietmar Eggemann <dietmar.eggemann@....com>
To: "pang.xunlei@....com.cn" <pang.xunlei@....com.cn>,
Morten Rasmussen <Morten.Rasmussen@....com>
CC: Juri Lelli <Juri.Lelli@....com>,
"linux-kernel@...r.kernel.org" <linux-kernel@...r.kernel.org>,
"linux-kernel-owner@...r.kernel.org"
<linux-kernel-owner@...r.kernel.org>,
"mingo@...hat.com" <mingo@...hat.com>,
"mturquette@...aro.org" <mturquette@...aro.org>,
"nico@...aro.org" <nico@...aro.org>,
"peterz@...radead.org" <peterz@...radead.org>,
"preeti@...ux.vnet.ibm.com" <preeti@...ux.vnet.ibm.com>,
"rjw@...ysocki.net" <rjw@...ysocki.net>,
"vincent.guittot@...aro.org" <vincent.guittot@...aro.org>,
"yuyang.du@...el.com" <yuyang.du@...el.com>
Subject: Re: [RFCv3 PATCH 37/48] sched: Determine the current sched_group
idle-state
On 30/04/15 06:12, pang.xunlei@....com.cn wrote:
> linux-kernel-owner@...r.kernel.org wrote 2015-02-05 AM 02:31:14:
>
>> Morten Rasmussen <morten.rasmussen@....com>
>>
>> [RFCv3 PATCH 37/48] sched: Determine the current sched_group idle-state
>>
>> To estimate the energy consumption of a sched_group in
>> sched_group_energy() it is necessary to know which idle-state the group
>> is in when it is idle. For now, it is assumed that this is the current
>> idle-state (though it might be wrong). Based on the individual cpu
>> idle-states group_idle_state() finds the group idle-state.
[...]
>> +static int group_idle_state(struct sched_group *sg)
>> +{
>> + struct sched_group_energy *sge = sg->sge;
>> + int shallowest_state = sge->idle_states_below + sge->nr_idle_states;
>> + int i;
>> +
>> + for_each_cpu(i, sched_group_cpus(sg)) {
>> + int cpuidle_idx = idle_get_state_idx(cpu_rq(i));
>> + int group_idx = cpuidle_idx - sge->idle_states_below + 1;
>
> So cpuidle_idx==0 for core-level(2 C-States for example) groups, it
> returns 1?
Yes.
>
> What does this mean?
So for ARM TC2 and CPU0 (Cortex A15, big) for example:
# cat /sys/devices/system/cpu/cpu0/cpuidle/state*/name
WFI [cpuidle_idx=0]
cluster-sleep-b [cpuidle_idx=1]
group_idx is the system C state re-indexed to the sd (e.g.on MC level
WFI is group idx 1 and on DIE level it's group idx 0).
For MC (or core-) level groups:
cpu=0 sg_mask=0x1 group_idx=1 cpuidle_idx=0 sge->idle_states_below=0
shallowest_state=1 sge->nr_idle_states=1
group_idle_state() returns 0 in this case because of (shallowest_state=1
>= sge->nr_idle_states=1).
This value is then used to index into the sg->sge->idle_states[] to get
the idle power value for the topology bit represented by sg (i.e. for
CPU0). The idle power value for CPU0 is originally specified in the
energy model:
static struct idle_state idle_states_core_a15[] = { .power = 0 }, };
[arch/arm/kernel/topology.c]
Another example would be to find the idle power value for the LITTLE
cluster if it is in 'cluster-sleep-l' [cpuidle_idx=1]:
cpu=2 sg_mask=0x1c group_idx=1 cpuidle_idx=1 sge->idle_states_below=1
shallowest_state=3 sge->nr_idle_states=2
cpu=3 sg_mask=0x1c group_idx=1 cpuidle_idx=1 sge->idle_states_below=1
shallowest_state=1 sge->nr_idle_states=2
cpu=3 sg_mask=0x1c group_idx=1 cpuidle_idx=1 sge->idle_states_below=1
shallowest_state=1 sge->nr_idle_states=2
group_idle_state() returns 1 (shallowest_state=1) and the idle power
value is 10.
static struct idle_state idle_states_cluster_a7[] = { ..., { .power = 10 }};
To sum it up, group_idle_state() is necessary to transform the C state
values (-1, 0, 1) into sg->sge->idle_states[] indexes for the different
sg's (MC, DIE).
[...]
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@...r.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/
Powered by blists - more mailing lists