Re: [PATCH] slub: do not put a slab to cpu partial list when cpu_partial is 0

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

 



On Wed, Jun 19, 2013 at 03:33:55PM +0900, Joonsoo Kim wrote:
>In free path, we don't check number of cpu_partial, so one slab can
>be linked in cpu partial list even if cpu_partial is 0. To prevent this,
>we should check number of cpu_partial in put_cpu_partial().
>

How about skip get_partial entirely? put_cpu_partial is called 
in two paths, one is during refill cpu partial lists in alloc 
slow path, the other is in free slow path. And cpu_partial is 0 
just in debug mode. 

- alloc slow path, there is unnecessary to call get_partial 
  since cpu partial lists won't be used in debug mode. 
- free slow patch, new.inuse won't be true in debug mode 
  which lead to put_cpu_partial won't be called.

Regards,
Wanpeng Li 

>Signed-off-by: Joonsoo Kim <iamjoonsoo.kim@xxxxxxx>
>
>diff --git a/mm/slub.c b/mm/slub.c
>index 57707f0..7033b4f 100644
>--- a/mm/slub.c
>+++ b/mm/slub.c
>@@ -1955,6 +1955,9 @@ static void put_cpu_partial(struct kmem_cache *s, struct page *page, int drain)
> 	int pages;
> 	int pobjects;
>
>+	if (!s->cpu_partial)
>+		return;
>+
> 	do {
> 		pages = 0;
> 		pobjects = 0;
>-- 
>1.7.9.5
>
>--
>To unsubscribe, send a message with 'unsubscribe linux-mm' in
>the body to majordomo@xxxxxxxxx.  For more info on Linux MM,
>see: http://www.linux-mm.org/ .
>Don't email: <a href=mailto:"dont@xxxxxxxxx";> email@xxxxxxxxx </a>

--
To unsubscribe, send a message with 'unsubscribe linux-mm' in
the body to majordomo@xxxxxxxxx.  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]