lkml.org 
[lkml]   [2014]   [Aug]   [25]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
/
Date
From
SubjectRe: [PATCH 3/3] mm/slab: support slab merge
On Thu, 21 Aug 2014, Joonsoo Kim wrote:

> diff --git a/mm/slab.c b/mm/slab.c
> index 09b060e..a1cc1c9 100644
> --- a/mm/slab.c
> +++ b/mm/slab.c
> @@ -2052,6 +2052,26 @@ static int __init_refok setup_cpu_cache(struct kmem_cache *cachep, gfp_t gfp)
> return 0;
> }
>
> +unsigned long kmem_cache_flags(unsigned long object_size,
> + unsigned long flags, const char *name,
> + void (*ctor)(void *))
> +{
> + return flags;
> +}
> +
> +struct kmem_cache *
> +__kmem_cache_alias(const char *name, size_t size, size_t align,
> + unsigned long flags, void (*ctor)(void *))
> +{
> + struct kmem_cache *cachep;
> +
> + cachep = find_mergeable(size, align, flags, name, ctor);
> + if (cachep)
> + cachep->refcount++;
> +
> + return cachep;
> +}
> +

These could be commonized as well. Make refcount a common field and then
the same function can be used for both caches.



\
 
 \ /
  Last update: 2014-08-25 17:41    [W:0.159 / U:0.528 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site