lkml.org 
[lkml]   [2015]   [Aug]   [12]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
/
Date
From
SubjectRe: [RFCv5 PATCH 16/46] sched: Allocate and initialize energy data structures
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()?


\
 
 \ /
  Last update: 2015-08-12 12:21    [W:1.032 / U:0.472 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site