[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <alpine.DEB.2.10.1506241359570.32420@vshiva-Udesk>
Date: Wed, 24 Jun 2015 14:11:48 -0700 (PDT)
From: Vikas Shivappa <vikas.shivappa@...ux.intel.com>
To: Thomas Gleixner <tglx@...utronix.de>
cc: Vikas Shivappa <vikas.shivappa@...ux.intel.com>,
linux-kernel@...r.kernel.org, x86@...nel.org, hpa@...or.com,
mingo@...nel.org, tj@...nel.org, peterz@...radead.org,
matt.fleming@...el.com, will.auld@...el.com,
glenn.p.williamson@...el.com, kanaka.d.juvva@...el.com,
priya.v.autee@...el.com
Subject: Re: [PATCH 01/10] cpumask: Introduce cpumask_any_online_but
On Wed, 24 Jun 2015, Thomas Gleixner wrote:
> On Tue, 23 Jun 2015, Vikas Shivappa wrote:
>> There is currently no cpumask helper function to pick a "random" cpu
>> from a mask which is also online.
>>
>> cpumask_any_online_but() does that which is similar to cpumask_any_but()
>> but also returns a cpu that is online.
>>
>> Signed-off-by: Vikas Shivappa <vikas.shivappa@...ux.intel.com>
>> ---
>> include/linux/cpumask.h | 18 ++++++++++++++++++
>> 1 file changed, 18 insertions(+)
>>
>> diff --git a/include/linux/cpumask.h b/include/linux/cpumask.h
>> index 27e285b..ea63b65 100644
>> --- a/include/linux/cpumask.h
>> +++ b/include/linux/cpumask.h
>> @@ -548,6 +548,24 @@ static inline void cpumask_copy(struct cpumask *dstp,
>> #define cpumask_of(cpu) (get_cpu_mask(cpu))
>>
>> /**
>> + * cpumask_any_online_but - return a "random" and online cpu in a cpumask,
>> + * but not this one
>> + * @mask: the input mask to search
>> + * @cpu: the cpu to ignore
>> + *
>> + * Returns >= nr_cpu_ids if no cpus set.
>> +*/
>> +static inline unsigned int cpumask_any_online_but(const struct cpumask *mask,
>> + unsigned int cpu)
>> +{
>> + static cpumask_t tmp;
>
> How is that supposed to work?
>
> You cannot expect, that all potential users of this function are
> magically serialized.
I am trying do something wierd with this API. trying to do
cpumask_and_any_but. But anything with 'and' operation, usually the caller
supplies the dst. Guess I can remove this API altogether and 'and' the online
and package cpu masks during hot cpu notifications.
Thanks,
Vikas
>
>> +
>> + cpumask_and(&tmp, cpu_online_mask, mask);
>> + cpumask_clear_cpu(cpu, &tmp);
>> + return cpumask_any(&tmp);
>
> Thanks,
>
> tglx
>
--
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