Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]
Groups > linux.kernel > #1205878 > unrolled thread
| Started by | Peter Zijlstra <peterz@infradead.org> |
|---|---|
| First post | 2015-08-12 12:10 +0200 |
| Last post | 2015-08-12 19:10 +0200 |
| Articles | 2 — 2 participants |
Back to article view | Back to linux.kernel
This discussion starts older than the indexed window; earlier articles aren't shown. The article labeled Started by
below is the oldest one visible, not the original post.
Re: [RFCv5 PATCH 16/46] sched: Allocate and initialize energy data structures Peter Zijlstra <peterz@infradead.org> - 2015-08-12 12:10 +0200
Re: [RFCv5 PATCH 16/46] sched: Allocate and initialize energy data structures Dietmar Eggemann <dietmar.eggemann@arm.com> - 2015-08-12 19:10 +0200
| From | Peter Zijlstra <peterz@infradead.org> |
|---|---|
| Date | 2015-08-12 12:10 +0200 |
| Subject | Re: [RFCv5 PATCH 16/46] sched: Allocate and initialize energy data structures |
| Message-ID | <pWB8S-1df-25@gated-at.bofh.it> |
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()?
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/
[toc] | [next] | [standalone]
| From | Dietmar Eggemann <dietmar.eggemann@arm.com> |
|---|---|
| Date | 2015-08-12 19:10 +0200 |
| Message-ID | <pWHHl-2fW-27@gated-at.bofh.it> |
| In reply to | #1205878 |
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@vger.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/
[toc] | [prev] | [standalone]
Back to top | Article view | linux.kernel
csiph-web