lkml.org 
[lkml]   [2008]   [Sep]   [12]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
/
DateFri, 12 Sep 2008 07:17:08 -0700
FromMike Travis <>
SubjectRe: [PATCH 1/3] cpumask: add for_each_online_cpu_mask_nr function
Rusty Russell wrote:
> On Wednesday 10 September 2008 01:50:14 Mike Travis wrote:
>> * Add for_each_online_cpu_mask_nr() function to eliminate need for
>> a common use of a temporary cpumask_t variable. When the following
>> procedure is being used:
>>
>> funcproto(cpumask_t *mask, ...)
>> {
>> cpumask_t temp;
>>
>> cpus_and(temp, *mask, cpu_online_map);
>> for_each_cpu_mask_nr(cpu, temp)
>> ...
>>
>> If then becomes:
>>
>> funcproto(cpumask_t *mask, ...)
>> {
>> for_each_online_cpu_mask_nr(cpu, *mask)
>> ...
>>
>> * Note the generic __next_cpu_and (and __next_cpu_and_nr) functions
>> allowing AND'ing with any cpumask_t variable, not just the
>> cpu_online_map.
>
> Good idea! But I really dislike the _nr versions (too many names!). Do we
> really need them, since by definition cpus after nr_cpu_ids are never
> online...
>
> (And we should initialize nr_cpu_ids to NR_CPUS so even early boot works, if
> we don't already...).
>
> Cheers,
> Rusty.

Yes, the only reason the _nr is there is to be consistent with the
current for_each_cpu_mask{,_nr} functions. What I'd like to do is
convert all calls to use the nr_cpu_ids and if there's some reason
to need to iterate over NR_CPUS range, then you'd use FOR_EACH_CPU_MASK.
And yes, nr_cpu_ids is init'd to NR_CPUS.

Thanks,
Mike


\
 
 \ /
  Last update: 2008-09-12 16:19    [from the cache]
©2003-2010