[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <55CB7DA1.1070600@arm.com>
Date: Wed, 12 Aug 2015 18:08:49 +0100
From: Dietmar Eggemann <dietmar.eggemann@....com>
To: Peter Zijlstra <peterz@...radead.org>,
Morten Rasmussen <Morten.Rasmussen@....com>
CC: "mingo@...hat.com" <mingo@...hat.com>,
"vincent.guittot@...aro.org" <vincent.guittot@...aro.org>,
"daniel.lezcano@...aro.org" <daniel.lezcano@...aro.org>,
"yuyang.du@...el.com" <yuyang.du@...el.com>,
"mturquette@...libre.com" <mturquette@...libre.com>,
"rjw@...ysocki.net" <rjw@...ysocki.net>,
Juri Lelli <Juri.Lelli@....com>,
"sgurrappadi@...dia.com" <sgurrappadi@...dia.com>,
"pang.xunlei@....com.cn" <pang.xunlei@....com.cn>,
"linux-kernel@...r.kernel.org" <linux-kernel@...r.kernel.org>,
"linux-pm@...r.kernel.org" <linux-pm@...r.kernel.org>
Subject: Re: [RFCv5 PATCH 16/46] sched: Allocate and initialize energy data
structures
On 12/08/15 11:04, Peter Zijlstra wrote:
> On Tue, Jul 07, 2015 at 07:23:59PM +0100, Morten Rasmussen wrote:
>> +
>> + sge->nr_idle_states = fn(cpu)->nr_idle_states;
>> + sge->nr_cap_states = fn(cpu)->nr_cap_states;
>> + memcpy(sge->idle_states, fn(cpu)->idle_states,
>> + sge->nr_idle_states*sizeof(struct idle_state));
>> + memcpy(sge->cap_states, fn(cpu)->cap_states,
>> + sge->nr_cap_states*sizeof(struct capacity_state));
>
>> + if (fn && fn(j)) {
>> + nr_idle_states = fn(j)->nr_idle_states;
>> + nr_cap_states = fn(j)->nr_cap_states;
>> + BUG_ON(!nr_idle_states || !nr_cap_states);
>> + }
>
>> + for_each_cpu(i, &mask) {
>> + int y;
>> +
>> + BUG_ON(fn(i)->nr_idle_states != fn(cpu)->nr_idle_states);
>> +
>> + for (y = 0; y < (fn(i)->nr_idle_states); y++) {
>> + BUG_ON(fn(i)->idle_states[y].power !=
>> + fn(cpu)->idle_states[y].power);
>> + }
>> +
>> + BUG_ON(fn(i)->nr_cap_states != fn(cpu)->nr_cap_states);
>> +
>> + for (y = 0; y < (fn(i)->nr_cap_states); y++) {
>> + BUG_ON(fn(i)->cap_states[y].cap !=
>> + fn(cpu)->cap_states[y].cap);
>> + BUG_ON(fn(i)->cap_states[y].power !=
>> + fn(cpu)->cap_states[y].power);
>> + }
>> + }
>> +}
>
> Might it not make more sense to have:
>
> const struct blah *const blah = fn();
>
> and use blah afterwards, instead of the repeated invocation of fn()?
Absolutely! I can change this in the next release.
--
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