linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] slub: change cmpxchg_double_slab in get_freelist() to __cmpxchg_double_slab
@ 2012-05-10 15:56 Joonsoo Kim
  2012-05-15  6:32 ` David Rientjes
  0 siblings, 1 reply; 5+ messages in thread
From: Joonsoo Kim @ 2012-05-10 15:56 UTC (permalink / raw)
  To: Pekka Enberg; +Cc: Christoph Lameter, linux-kernel, linux-mm, Joonsoo Kim

get_freelist() is only called by __slab_alloc with interrupt disabled,
so __cmpxchg_double_slab is suitable.

Signed-off-by: Joonsoo Kim <js1304@gmail.com>

diff --git a/mm/slub.c b/mm/slub.c
index 323778e..addfb85 100644
--- a/mm/slub.c
+++ b/mm/slub.c
@@ -2176,7 +2176,7 @@ static inline void *get_freelist(struct kmem_cache *s, struct page *page)
 		new.inuse = page->objects;
 		new.frozen = freelist != NULL;
 
-	} while (!cmpxchg_double_slab(s, page,
+	} while (!__cmpxchg_double_slab(s, page,
 		freelist, counters,
 		NULL, new.counters,
 		"get_freelist"));
-- 
1.7.9.5


^ permalink raw reply related	[flat|nested] 5+ messages in thread

* Re: [PATCH] slub: change cmpxchg_double_slab in get_freelist() to __cmpxchg_double_slab
  2012-05-10 15:56 [PATCH] slub: change cmpxchg_double_slab in get_freelist() to __cmpxchg_double_slab Joonsoo Kim
@ 2012-05-15  6:32 ` David Rientjes
  2012-05-31 20:52   ` David Rientjes
  0 siblings, 1 reply; 5+ messages in thread
From: David Rientjes @ 2012-05-15  6:32 UTC (permalink / raw)
  To: Joonsoo Kim; +Cc: Pekka Enberg, Christoph Lameter, linux-kernel, linux-mm

On Fri, 11 May 2012, Joonsoo Kim wrote:

> get_freelist() is only called by __slab_alloc with interrupt disabled,
> so __cmpxchg_double_slab is suitable.
> 
> Signed-off-by: Joonsoo Kim <js1304@gmail.com>

Acked-by: David Rientjes <rientjes@google.com>

^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: [PATCH] slub: change cmpxchg_double_slab in get_freelist() to __cmpxchg_double_slab
  2012-05-15  6:32 ` David Rientjes
@ 2012-05-31 20:52   ` David Rientjes
  2012-06-01  6:39     ` Pekka Enberg
  0 siblings, 1 reply; 5+ messages in thread
From: David Rientjes @ 2012-05-31 20:52 UTC (permalink / raw)
  To: Joonsoo Kim, Pekka Enberg; +Cc: Christoph Lameter, linux-kernel, linux-mm

On Mon, 14 May 2012, David Rientjes wrote:

> On Fri, 11 May 2012, Joonsoo Kim wrote:
> 
> > get_freelist() is only called by __slab_alloc with interrupt disabled,
> > so __cmpxchg_double_slab is suitable.
> > 
> > Signed-off-by: Joonsoo Kim <js1304@gmail.com>
> 
> Acked-by: David Rientjes <rientjes@google.com>
> 

Pekka, did you want to pick this up so it can get into linux-next?

^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: [PATCH] slub: change cmpxchg_double_slab in get_freelist() to __cmpxchg_double_slab
  2012-05-31 20:52   ` David Rientjes
@ 2012-06-01  6:39     ` Pekka Enberg
  2012-06-01 12:18       ` JoonSoo Kim
  0 siblings, 1 reply; 5+ messages in thread
From: Pekka Enberg @ 2012-06-01  6:39 UTC (permalink / raw)
  To: David Rientjes
  Cc: Joonsoo Kim, Christoph Lameter, linux-kernel, linux-mm, torvalds

On Mon, 14 May 2012, David Rientjes wrote:
> > On Fri, 11 May 2012, Joonsoo Kim wrote:
> > 
> > > get_freelist() is only called by __slab_alloc with interrupt disabled,
> > > so __cmpxchg_double_slab is suitable.
> > > 
> > > Signed-off-by: Joonsoo Kim <js1304@gmail.com>
> > 
> > Acked-by: David Rientjes <rientjes@google.com>

On Thu, 31 May 2012, David Rientjes wrote:
> Pekka, did you want to pick this up so it can get into linux-next?

We now made get_freelist() *require* interrupts to be disabled which 
deserves a comment, no?

Also, what do we gain from patches like this? It's somewhat 
counterintuitive that we have a function with "cmpxchg" in it which is not 
always atomic (i.e. you need to have interrupts disabled).

IIRC, there was even a long rant about this by Linus but I'm unable to 
find it in my email archives.

			Pekka

^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: [PATCH] slub: change cmpxchg_double_slab in get_freelist() to __cmpxchg_double_slab
  2012-06-01  6:39     ` Pekka Enberg
@ 2012-06-01 12:18       ` JoonSoo Kim
  0 siblings, 0 replies; 5+ messages in thread
From: JoonSoo Kim @ 2012-06-01 12:18 UTC (permalink / raw)
  To: Pekka Enberg
  Cc: David Rientjes, Christoph Lameter, linux-kernel, linux-mm, torvalds

> We now made get_freelist() *require* interrupts to be disabled which
> deserves a comment, no?

I resend patch(18 May) related to this comment.
See below link.
http://thread.gmane.org/gmane.linux.kernel.mm/78630/focus=78701

> Also, what do we gain from patches like this? It's somewhat
> counterintuitive that we have a function with "cmpxchg" in it which is not
> always atomic (i.e. you need to have interrupts disabled).

Hmm...
This patch have a minor impact which saves a few instructions.
But we already have a "__cmpxchg" version which works in irq disabled,
so there is no reason for not applying it.

^ permalink raw reply	[flat|nested] 5+ messages in thread

end of thread, other threads:[~2012-06-01 12:18 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2012-05-10 15:56 [PATCH] slub: change cmpxchg_double_slab in get_freelist() to __cmpxchg_double_slab Joonsoo Kim
2012-05-15  6:32 ` David Rientjes
2012-05-31 20:52   ` David Rientjes
2012-06-01  6:39     ` Pekka Enberg
2012-06-01 12:18       ` JoonSoo Kim

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).