Skip to contentSkip to conversation

slub: change cmpxchg_double_slab in get_freelist() to __cmpxchg_double_slab

PATCH In review Joonsoo Kim 3 participants 5 messages May 10, 2012 – Jun 1, 2012

Subsystems (2)
lore
Share & tools
lore
#0 lore raw

PATCH 1/1 slub: change cmpxchg_double_slab in get_freelist() to __cmpxchg_double_slab

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

mm/slub.c +1 -1
index 323778e..addfb85 100644
@@ -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"));
Signature · 8 lines
1.7.9.5

--
To unsubscribe, send a message with 'unsubscribe linux-mm' in
the body to [email protected].  For more info on Linux MM,
see: http://www.linux-mm.org/ .
Fight unfair telecom internet charges in Canada: sign http://stopthemeter.ca/
Don't email: <a href=mailto:"[email protected]"> [email protected] </a>
reviewer Acked-by on v1 1/1
#1 lore raw
Quoted 4 lines · Joonsoo Kim

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

--
To unsubscribe, send a message with 'unsubscribe linux-mm' in
the body to [email protected]. For more info on Linux MM,
see: http://www.linux-mm.org/ .
Fight unfair telecom internet charges in Canada: sign http://stopthemeter.ca/
Don't email: <a href=mailto:"[email protected]"> [email protected] </a>

#2 lore raw
Quoted 9 lines · David Rientjes
Quoted 4 lines · Joonsoo Kim

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

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

--
To unsubscribe, send a message with 'unsubscribe linux-mm' in
the body to [email protected]. For more info on Linux MM,
see: http://www.linux-mm.org/ .
Fight unfair telecom internet charges in Canada: sign http://stopthemeter.ca/
Don't email: <a href=mailto:"[email protected]"> [email protected] </a>

#3 lore raw
Quoted 8 lines · David Rientjes
Quoted 8 lines · Joonsoo Kim
Quoted 5 lines

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

Quoted 1 line · David Rientjes

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

--
To unsubscribe, send a message with 'unsubscribe linux-mm' in
the body to [email protected]. For more info on Linux MM,
see: http://www.linux-mm.org/ .
Fight unfair telecom internet charges in Canada: sign http://stopthemeter.ca/
Don't email: <a href=mailto:"[email protected]"> [email protected] </a>

#4 lore raw
Quoted 2 lines

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

Quoted 3 lines

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.

--
To unsubscribe, send a message with 'unsubscribe linux-mm' in
the body to [email protected]. For more info on Linux MM,
see: http://www.linux-mm.org/ .
Fight unfair telecom internet charges in Canada: sign http://stopthemeter.ca/
Don't email: <a href=mailto:"[email protected]"> [email protected] </a>