Re: [RFC PATCH 02/10] sched: Task placement for heterogeneous systemsbased on task load-tracking

From: Viresh Kumar
Date: Tue Oct 09 2012 - 12:58:14 EST


On 9 October 2012 21:26, Morten Rasmussen <Morten.Rasmussen@xxxxxxx> wrote:
> On Thu, Oct 04, 2012 at 07:02:03AM +0100, Viresh Kumar wrote:
>> On 22 September 2012 00:02, <morten.rasmussen@xxxxxxx> wrote:

>> > SCHED_HMP requires that the platform implements arch_get_hmp_domains()
>> > which should set up the platform specific list of hmp_domains. It is
>> > also assumed that the platform disables SD_LOAD_BALANCE for the
>> > appropriate sched_domains.
>>
>> An explanation of this requirement would be helpful here.
>
> Yes. This is to prevent the load-balancer from moving tasks between
> hmp_domains. This will be done exclusively by SCHED_HMP instead to
> implement a strict task migration policy and avoid changing the
> load-balancer behaviour. The load-balancer will take care of
> load-balacing within each hmp_domain.

Honestly speaking i understood this point now and earlier it wasn't clear
to me :)

What would be ideal is to put this information in the comment just before
we re-define other SCHED_*** domains where we disable balancing.
And keep it in the commit log too.

>> > +struct hmp_domain {
>> > + struct cpumask cpus;
>> > + struct list_head hmp_domains;
>>
>> Probably need a better name here. domain_list?
>
> Yes. hmp_domain_list would be better and stick with the hmp_* naming
> convention.

IMHO hmp_ would be better for global names, but names of variables
enclosed within another hmp_*** data type don't actually need hmp_**,
as this is implicity.

i.e.
struct hmp_domain {
struct cpumask cpus;
struct list_head domain_list;
}

would be better than
struct list_head hmp domain_list;

as the parent structure already have hmp_***. So whatever is inside the
struct is obviously hmp specific.

>> > +/* Setup hmp_domains */
>> > +static int __init hmp_cpu_mask_setup(void)
>>
>> How should we interpret its return value? Can you mention what does 0 & 1 mean
>> here?
>>
>
> Returns 0 if domain setup failed, i.e. the domain list is empty, and 1
> otherwise.

Helpful. Please mention this in function comment in your next revision.

>> > +{
>> > + char buf[64];
>> > + struct hmp_domain *domain;
>> > + struct list_head *pos;
>> > + int dc, cpu;

>> > + /* Print hmp_domains */
>> > + dc = 0;
>>
>> Should be done during definition of dc.

You missed this ??

>> > + for_each_cpu_mask(cpu, domain->cpus) {
>> > + per_cpu(hmp_cpu_domain, cpu) = domain;
>> > + }
>>
>> Should use hmp_cpu_domain(cpu) here. Also no need of {} for single
>> line loop.

??

>> > + dc++;
>>
>> You aren't using it... Only for testing? Should we remove it from mainline
>> patchset and keep it locally?
>>
>
> I'm using it in the pr_debug line a little earlier. It is used for
> enumerating the hmp_domains.

My mistake :(

>> > +/* Check if cpu is in fastest hmp_domain */
>> > +static inline unsigned int hmp_cpu_is_fastest(int cpu)
>> > +{
>> > + struct list_head *pos;
>> > +
>> > + pos = &hmp_cpu_domain(cpu)->hmp_domains;
>> > + return pos == hmp_domains.next;
>>
>> better create list_is_first() for this.
>
> I had the same thought, but I see that as a separate patch that should
> be submitted separately.

Correct. So better send it now, so that it is included before you send your
next version. :)

--
viresh
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/