Re: [RFC v2 PATCH] mm, sl[au]b: Introduce lockless cache

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

 



> @@ -491,13 +492,13 @@ void kmem_cache_free_cached(struct kmem_cache *s, void *p)
>         cache = get_cpu_ptr(s->cache);
>         if (cache->size < KMEM_LOCKLESS_CACHE_QUEUE_SIZE) {
>                 cache->queue[cache->size++] = p;
> -               put_cpu_ptr(s->cache);
> -               return ;
> +       } else {
> +               kmem_cache_free_bulk(s,
> +                               KMEM_LOCKLESS_CACHE_BATCHCOUNT,
> +                               cache->queue - KMEM_LOCKLESS_CACHE_BATCHCOUNT);
> +               cache->size -= KMEM_LOCKLESS_CACHE_BATCHCOUNT;
>         }
>         put_cpu_ptr(s->cache);
> -
> -       /* Is there better way to do this? */
> -       kmem_cache_free(s, p);
>  }
>  EXPORT_SYMBOL(kmem_cache_free_cached);

Sent you a wrong code.

Above was buggy code from some hours ago 
because of cache->queue - KMEM_LOCKLESS_CACHE_BATCHCOUNT.

So that is now:

	cache = get_cpu_ptr(s->cache);
	if (cache->size < KMEM_LOCKLESS_CACHE_QUEUE_SIZE) {
		cache->queue[cache->size++] = p;
	} else {
		kmem_cache_free_bulk(s,
				KMEM_LOCKLESS_CACHE_BATCHCOUNT,
				cache->queue + KMEM_LOCKLESS_CACHE_QUEUE_SIZE
				- KMEM_LOCKLESS_CACHE_BATCHCOUNT);
		cache->size -= KMEM_LOCKLESS_CACHE_BATCHCOUNT;
	}
	put_cpu_ptr(s->cache);




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

  Powered by Linux