* SLUB: simplify re on_each_cpu()
@ 2008-07-16 17:29 Alexey Dobriyan
2008-07-16 17:36 ` Christoph Lameter
` (2 more replies)
0 siblings, 3 replies; 7+ messages in thread
From: Alexey Dobriyan @ 2008-07-16 17:29 UTC (permalink / raw)
To: cl, penberg; +Cc: linux-kernel
on_each_cpu() expands to function call on UP, too.
Signed-off-by: Alexey Dobriyan <adobriyan@gmail.com>
---
mm/slub.c | 8 --------
1 file changed, 8 deletions(-)
--- a/mm/slub.c
+++ b/mm/slub.c
@@ -1495,15 +1495,7 @@ static void flush_cpu_slab(void *d)
static void flush_all(struct kmem_cache *s)
{
-#ifdef CONFIG_SMP
on_each_cpu(flush_cpu_slab, s, 1);
-#else
- unsigned long flags;
-
- local_irq_save(flags);
- flush_cpu_slab(s);
- local_irq_restore(flags);
-#endif
}
/*
^ permalink raw reply [flat|nested] 7+ messages in thread
* Re: SLUB: simplify re on_each_cpu()
2008-07-16 17:29 SLUB: simplify re on_each_cpu() Alexey Dobriyan
@ 2008-07-16 17:36 ` Christoph Lameter
2008-07-16 20:58 ` Pekka Enberg
2008-07-17 11:38 ` Robin Holt
2 siblings, 0 replies; 7+ messages in thread
From: Christoph Lameter @ 2008-07-16 17:36 UTC (permalink / raw)
To: Alexey Dobriyan; +Cc: penberg, linux-kernel
Acked-by: Christoph Lameter <cl@linux-foundation.org>
^ permalink raw reply [flat|nested] 7+ messages in thread
* Re: SLUB: simplify re on_each_cpu()
2008-07-16 17:29 SLUB: simplify re on_each_cpu() Alexey Dobriyan
2008-07-16 17:36 ` Christoph Lameter
@ 2008-07-16 20:58 ` Pekka Enberg
2008-07-17 11:38 ` Robin Holt
2 siblings, 0 replies; 7+ messages in thread
From: Pekka Enberg @ 2008-07-16 20:58 UTC (permalink / raw)
To: Alexey Dobriyan; +Cc: cl, linux-kernel
On Wed, Jul 16, 2008 at 8:29 PM, Alexey Dobriyan <adobriyan@gmail.com> wrote:
> on_each_cpu() expands to function call on UP, too.
>
> Signed-off-by: Alexey Dobriyan <adobriyan@gmail.com>
Applied, thanks!
^ permalink raw reply [flat|nested] 7+ messages in thread
* Re: SLUB: simplify re on_each_cpu()
2008-07-16 17:29 SLUB: simplify re on_each_cpu() Alexey Dobriyan
2008-07-16 17:36 ` Christoph Lameter
2008-07-16 20:58 ` Pekka Enberg
@ 2008-07-17 11:38 ` Robin Holt
2008-07-17 12:26 ` Pekka Enberg
2 siblings, 1 reply; 7+ messages in thread
From: Robin Holt @ 2008-07-17 11:38 UTC (permalink / raw)
To: Alexey Dobriyan; +Cc: cl, penberg, linux-kernel
On Wed, Jul 16, 2008 at 09:29:02PM +0400, Alexey Dobriyan wrote:
> on_each_cpu() expands to function call on UP, too.
It looks to me like on_each_cpu is a #define for !SMP. Are you certain
of the need for this change? Are you looking at a different tree than
Linus'?
Thanks,
Robin
>
> Signed-off-by: Alexey Dobriyan <adobriyan@gmail.com>
> ---
>
> mm/slub.c | 8 --------
> 1 file changed, 8 deletions(-)
>
> --- a/mm/slub.c
> +++ b/mm/slub.c
> @@ -1495,15 +1495,7 @@ static void flush_cpu_slab(void *d)
>
> static void flush_all(struct kmem_cache *s)
> {
> -#ifdef CONFIG_SMP
> on_each_cpu(flush_cpu_slab, s, 1);
> -#else
> - unsigned long flags;
> -
> - local_irq_save(flags);
> - flush_cpu_slab(s);
> - local_irq_restore(flags);
> -#endif
> }
>
> /*
>
> --
> To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
> the body of a message to majordomo@vger.kernel.org
> More majordomo info at http://vger.kernel.org/majordomo-info.html
> Please read the FAQ at http://www.tux.org/lkml/
^ permalink raw reply [flat|nested] 7+ messages in thread
* Re: SLUB: simplify re on_each_cpu()
2008-07-17 11:38 ` Robin Holt
@ 2008-07-17 12:26 ` Pekka Enberg
2008-07-17 12:39 ` Robin Holt
0 siblings, 1 reply; 7+ messages in thread
From: Pekka Enberg @ 2008-07-17 12:26 UTC (permalink / raw)
To: Robin Holt; +Cc: Alexey Dobriyan, cl, linux-kernel
Hi Robin,
On Wed, Jul 16, 2008 at 09:29:02PM +0400, Alexey Dobriyan wrote:
>> on_each_cpu() expands to function call on UP, too.
On Thu, Jul 17, 2008 at 2:38 PM, Robin Holt <holt@sgi.com> wrote:
> It looks to me like on_each_cpu is a #define for !SMP. Are you certain
> of the need for this change? Are you looking at a different tree than
> Linus'?
I think it's actually you who is looking at an older tree.
However, while double-checking this, I noticed that for UP,
on_each_cpu() enables interrupts unconditionally with
local_irq_enable() whereas the call while the old code in SLUB did a
local_irq_restore() that preserves the irq mask. Looking at the
callers of flush_all() in mm/slub.c, the change looks okay, but it's
still bit strange on_each_cpu() works that way on UP.
Pekka
^ permalink raw reply [flat|nested] 7+ messages in thread
* Re: SLUB: simplify re on_each_cpu()
2008-07-17 12:26 ` Pekka Enberg
@ 2008-07-17 12:39 ` Robin Holt
2008-07-17 12:55 ` Vegard Nossum
0 siblings, 1 reply; 7+ messages in thread
From: Robin Holt @ 2008-07-17 12:39 UTC (permalink / raw)
To: Pekka Enberg; +Cc: Robin Holt, Alexey Dobriyan, cl, linux-kernel
On Thu, Jul 17, 2008 at 03:26:46PM +0300, Pekka Enberg wrote:
> Hi Robin,
>
> On Wed, Jul 16, 2008 at 09:29:02PM +0400, Alexey Dobriyan wrote:
> >> on_each_cpu() expands to function call on UP, too.
>
> On Thu, Jul 17, 2008 at 2:38 PM, Robin Holt <holt@sgi.com> wrote:
> > It looks to me like on_each_cpu is a #define for !SMP. Are you certain
> > of the need for this change? Are you looking at a different tree than
> > Linus'?
>
> I think it's actually you who is looking at an older tree.
I did a git-checkout of
git://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux-2.6.git
which got me commit id 33af79d12e0fa25545d49e86afc67ea8ad5f2f40
and looked at include/linux/smp.h line 123. It has:
#define on_each_cpu(func,info,wait) \
({ \
local_irq_disable(); \
func(info); \
local_irq_enable(); \
0; \
})
This is the !CONFIG_SMP case (line 111). When I look at
kernel/softirq.c, I notice immediately prior to the comment the #ifdef
CONFIG_SMP.
They appear equivalent. What am I missing?
Thanks,
Robin
^ permalink raw reply [flat|nested] 7+ messages in thread
* Re: SLUB: simplify re on_each_cpu()
2008-07-17 12:39 ` Robin Holt
@ 2008-07-17 12:55 ` Vegard Nossum
0 siblings, 0 replies; 7+ messages in thread
From: Vegard Nossum @ 2008-07-17 12:55 UTC (permalink / raw)
To: Robin Holt; +Cc: Pekka Enberg, Alexey Dobriyan, cl, linux-kernel
On Thu, Jul 17, 2008 at 2:39 PM, Robin Holt <holt@sgi.com> wrote:
> On Thu, Jul 17, 2008 at 03:26:46PM +0300, Pekka Enberg wrote:
>> Hi Robin,
>>
>> On Wed, Jul 16, 2008 at 09:29:02PM +0400, Alexey Dobriyan wrote:
>> >> on_each_cpu() expands to function call on UP, too.
>>
>> On Thu, Jul 17, 2008 at 2:38 PM, Robin Holt <holt@sgi.com> wrote:
>> > It looks to me like on_each_cpu is a #define for !SMP. Are you certain
>> > of the need for this change? Are you looking at a different tree than
>> > Linus'?
>>
>> I think it's actually you who is looking at an older tree.
>
> I did a git-checkout of
> git://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux-2.6.git
> which got me commit id 33af79d12e0fa25545d49e86afc67ea8ad5f2f40
> and looked at include/linux/smp.h line 123. It has:
>
> #define on_each_cpu(func,info,wait) \
> ({ \
> local_irq_disable(); \
> func(info); \
That's the function call right there :-)
Vegard
--
"The animistic metaphor of the bug that maliciously sneaked in while
the programmer was not looking is intellectually dishonest as it
disguises that the error is the programmer's own creation."
-- E. W. Dijkstra, EWD1036
^ permalink raw reply [flat|nested] 7+ messages in thread
end of thread, other threads:[~2008-07-17 12:55 UTC | newest]
Thread overview: 7+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2008-07-16 17:29 SLUB: simplify re on_each_cpu() Alexey Dobriyan
2008-07-16 17:36 ` Christoph Lameter
2008-07-16 20:58 ` Pekka Enberg
2008-07-17 11:38 ` Robin Holt
2008-07-17 12:26 ` Pekka Enberg
2008-07-17 12:39 ` Robin Holt
2008-07-17 12:55 ` Vegard Nossum
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox