Re: slub: discard_slab_unlock

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On Tue, 15 Jun 2010, Christoph Lameter wrote:

> Subject: slub: discard_slab_unlock
> 
> The sequence of unlocking a slab and freeing occurs multiple times.
> Put the common into a single function.
> 

I personally don't see the benefit in this patch, it simply makes it 
harder for me to find if there are unmatched slab_lock() -> slab_unlock().  
There's no compelling reason to have it and, if done in a generic 
subsystem, we'd have an infinite number of these unlocking functions to 
enforce an order that should otherwise be pretty clear.

That said, I think something like the following would be better if 
nothing more than to annotate the code (we tend to read code better than 
comments :) about the rules:

diff --git a/mm/slub.c b/mm/slub.c
--- a/mm/slub.c
+++ b/mm/slub.c
@@ -1233,6 +1233,7 @@ static void free_slab(struct kmem_cache *s, struct page *page)
 
 static void discard_slab(struct kmem_cache *s, struct page *page)
 {
+	BUG_ON(bit_spin_is_locked(PG_locked, &page->flags));
 	dec_slabs_node(s, page_to_nid(page), page->objects);
 	free_slab(s, page);
 }

--
To unsubscribe, send a message with 'unsubscribe linux-mm' in
the body to majordomo@xxxxxxxxxx  For more info on Linux MM,
see: http://www.linux-mm.org/ .
Don't email: <a href=mailto:"dont@xxxxxxxxx";> email@xxxxxxxxx </a>


[Index of Archives]     [Linux ARM Kernel]     [Linux ARM]     [Linux Omap]     [Fedora ARM]     [IETF Annouce]     [Bugtraq]     [Linux]     [Linux OMAP]     [Linux MIPS]     [ECOS]     [Asterisk Internet PBX]     [Linux API]