[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Date: Wed, 10 Oct 2012 14:29:02 +0100
From: Morten Rasmussen <Morten.Rasmussen@....com>
To: Viresh Kumar <viresh.kumar@...aro.org>
Cc: "paulmck@...ux.vnet.ibm.com" <paulmck@...ux.vnet.ibm.com>,
"pjt@...gle.com" <pjt@...gle.com>,
"peterz@...radead.org" <peterz@...radead.org>,
"suresh.b.siddha@...el.com" <suresh.b.siddha@...el.com>,
"linaro-sched-sig@...ts.linaro.org"
<linaro-sched-sig@...ts.linaro.org>,
"linaro-dev@...ts.linaro.org" <linaro-dev@...ts.linaro.org>,
"linux-kernel@...r.kernel.org" <linux-kernel@...r.kernel.org>,
Arvind Chauhan <Arvind.Chauhan@....com>,
Robin Randhawa <Robin.Randhawa@....com>,
Amit Kucheria <amit.kucheria@...aro.org>
Subject: Re: [RFC PATCH 07/10] ARM: sched: Setup SCHED_HMP domains
On Thu, Oct 04, 2012 at 07:58:45AM +0100, Viresh Kumar wrote:
> On 22 September 2012 00:02, <morten.rasmussen@....com> wrote:
> > diff --git a/arch/arm/kernel/topology.c b/arch/arm/kernel/topology.c
>
> > +void __init arch_get_hmp_domains(struct list_head *hmp_domains_list)
> > +{
> > + struct cpumask hmp_fast_cpu_mask;
> > + struct cpumask hmp_slow_cpu_mask;
>
> can be merged to single line.
>
> > + struct hmp_domain *domain;
> > +
> > + arch_get_fast_and_slow_cpus(&hmp_fast_cpu_mask, &hmp_slow_cpu_mask);
> > +
> > + /*
> > + * Initialize hmp_domains
> > + * Must be ordered with respect to compute capacity.
> > + * Fastest domain at head of list.
> > + */
> > + domain = (struct hmp_domain *)
> > + kmalloc(sizeof(struct hmp_domain), GFP_KERNEL);
>
> should be:
>
> domain = kmalloc(sizeof(*domain), GFP_KERNEL);
>
> > + cpumask_copy(&domain->cpus, &hmp_slow_cpu_mask);
>
> what if kmalloc failed?
>
> > + list_add(&domain->hmp_domains, hmp_domains_list);
> > + domain = (struct hmp_domain *)
> > + kmalloc(sizeof(struct hmp_domain), GFP_KERNEL);
>
> would be better to kmalloc only once with size 2* sizeof(*domain)
>
> > + cpumask_copy(&domain->cpus, &hmp_fast_cpu_mask);
> > + list_add(&domain->hmp_domains, hmp_domains_list);
>
> Also would be better to create a macro for above two lines to remove
> code redundancy.
>
Agree on all of the above.
Thanks,
Morten
--
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