On 27 March 2013 12:09, Tang Yuantian-B29983 <B29983@xxxxxxxxxxxxx> wrote: > Viresh Kumar <viresh.kumar <at> linaro.org> writes: >> On Tue, Mar 26, 2013 at 8:06 AM, <Yuantian.Tang <at> freescale.com> >> > + * struct cpu_data - per CPU data struct > >> For your case where you have 8 cpus in a cluster, only one of 8 variables > >> would be used... Better to create an array of struct with elements: > >> cpu and data. > >> > > You are right. But we can’t use array struct because we don’t know the cpu > numbers > > in advance. If we allocate it dynamically, there would complicate things. > > Besides, this per cpu data struct would not occupy too memory. >> > + struct device_node *np; >> > + struct device_node *parent; >> > + struct cpufreq_frequency_table *table; Atleast 12 bytes per cpu. >> > +static DEFINE_PER_CPU(struct cpu_data, cpu_data); What about: static DEFINE_PER_CPU(struct cpu_data *, cpu_data); and allocate them dynamically. So you would save 8 bytes per cpu. >> > + sizeof(struct cpufreq_frequency_table), >> > GFP_KERNEL); > >> sizeof(*table) You missed this. >> > + for (i = 0; i < count; i++) { > >> > + table[i].index = i; > >> > + clk = of_clk_get(data->parent, i); > >> > + table[i].frequency = clk_get_rate(clk) / 1000; > >> > + freq_table_redup(table, i); > >> > >> Don't call it everytime, fix all these in a single call. > >> > > NO, not all the CPUs use the same frequency table. > > Generally, we have one or two frequency tables. > > So, this table needs to be established for each cpu. You didn't get me. Don't call freq_table_redup() for every table entry. Call it once per policy-init >> > +static int corenet_cpufreq_verify(struct cpufreq_policy *policy) >> > +{ >> > + struct cpufreq_frequency_table *table; >> > + >> > + table = (&per_cpu(cpu_data, policy->cpu))->table; >> > + if (!table) >> > + return -EINVAL; > >> > >> This should never be true. > > don't understand what's your point here. could you elaborate it? Sure. table should always be vaild. How can this be NULL ever? -- To unsubscribe from this list: send the line "unsubscribe cpufreq" in the body of a message to majordomo@xxxxxxxxxxxxxxx More majordomo info at http://vger.kernel.org/majordomo-info.html