[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <CAOtvUMcx0etVbYWz_z66ns9NbU=rvRChQqc1YYYYNJjYmOUsoQ@mail.gmail.com>
Date: Sun, 8 Jan 2012 18:04:19 +0200
From: Gilad Ben-Yossef <gilad@...yossef.com>
To: Andrew Morton <akpm@...ux-foundation.org>
Cc: linux-kernel@...r.kernel.org, Chris Metcalf <cmetcalf@...era.com>,
Peter Zijlstra <a.p.zijlstra@...llo.nl>,
Frederic Weisbecker <fweisbec@...il.com>,
Russell King <linux@....linux.org.uk>, linux-mm@...ck.org,
Pekka Enberg <penberg@...nel.org>,
Matt Mackall <mpm@...enic.com>, Rik van Riel <riel@...hat.com>,
Andi Kleen <andi@...stfloor.org>,
Sasha Levin <levinsasha928@...il.com>,
Mel Gorman <mel@....ul.ie>,
Alexander Viro <viro@...iv.linux.org.uk>,
linux-fsdevel@...r.kernel.org, Avi Kivity <avi@...hat.com>
Subject: Re: [PATCH v5 1/8] smp: Introduce a generic on_each_cpu_mask function
On Wed, Jan 4, 2012 at 12:26 AM, Andrew Morton
<akpm@...ux-foundation.org> wrote:
> On Mon, 2 Jan 2012 12:24:12 +0200
> Gilad Ben-Yossef <gilad@...yossef.com> wrote:
>
>> on_each_cpu_mask calls a function on processors specified my cpumask,
>> which may include the local processor.
>>
>> All the limitation specified in smp_call_function_many apply.
>>
>> ...
>>
>> --- a/include/linux/smp.h
>> +++ b/include/linux/smp.h
>> @@ -102,6 +102,13 @@ static inline void call_function_init(void) { }
>> int on_each_cpu(smp_call_func_t func, void *info, int wait);
>>
>> /*
>> + * Call a function on processors specified by mask, which might include
>> + * the local one.
>> + */
>> +void on_each_cpu_mask(const struct cpumask *mask, void (*func)(void *),
>> + void *info, bool wait);
>> +
>> +/*
>> * Mark the boot cpu "online" so that it can call console drivers in
>> * printk() and can access its per-cpu storage.
>> */
>> @@ -132,6 +139,15 @@ static inline int up_smp_call_function(smp_call_func_t func, void *info)
>> local_irq_enable(); \
>> 0; \
>> })
>> +#define on_each_cpu_mask(mask, func, info, wait) \
>> + do { \
>> + if (cpumask_test_cpu(0, (mask))) { \
>> + local_irq_disable(); \
>> + (func)(info); \
>> + local_irq_enable(); \
>> + } \
>> + } while (0)
>
> Why is the cpumask_test_cpu() call there? It's hard to think of a
> reason why "mask" would specify any CPU other than "0" in a
> uniprocessor kernel.
As Michal already answered, because the current CPU might be not
specified in the mask, even on UP.
> If this code remains as-is, please add a comment here explaining this,
> so others don't wonder the same thing.
Comment added and will be included in V6.
Thanks for the review.
Gilad
--
Gilad Ben-Yossef
Chief Coffee Drinker
gilad@...yossef.com
Israel Cell: +972-52-8260388
US Cell: +1-973-8260388
http://benyossef.com
"Unfortunately, cache misses are an equal opportunity pain provider."
-- Mike Galbraith, LKML
--
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