Re: [PATCH] slub: try to get cpu partial slab even if we get enough objects for cpu freelist

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

 



On Thu, 16 Aug 2012, JoonSoo Kim wrote:

> But, if you prefer that s->cpu_partial is for both cpu slab and cpu
> partial slab,
> get_partial_node() needs an another minor fix.
> We should add number of objects in cpu slab when we refill cpu partial slab.
> Following is my suggestion.
>
> @@ -1546,7 +1546,7 @@ static void *get_partial_node(struct kmem_cache *s,
>         spin_lock(&n->list_lock);
>         list_for_each_entry_safe(page, page2, &n->partial, lru) {
>                 void *t = acquire_slab(s, n, page, object == NULL);
> -               int available;
> +               int available, nr = 0;
>
>                 if (!t)
>                         break;
> @@ -1557,10 +1557,10 @@ static void *get_partial_node(struct kmem_cache *s,
>                         object = t;
>                         available =  page->objects - page->inuse;
>                 } else {
> -                       available = put_cpu_partial(s, page, 0);
> +                       nr = put_cpu_partial(s, page, 0);
>                         stat(s, CPU_PARTIAL_NODE);
>                 }
> -               if (kmem_cache_debug(s) || available > s->cpu_partial / 2)
> +               if (kmem_cache_debug(s) || (available + nr) >
> s->cpu_partial / 2)
>                         break;
>
>         }
>
> If you agree with this suggestion, I send a patch for this.

What difference does this patch make? At the end of the day you need the
total number of objects available in the partial slabs and the cpu slab
for comparison.

--
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]