lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <alpine.DEB.2.02.1405071818060.5305@chino.kir.corp.google.com>
Date:	Wed, 7 May 2014 18:19:13 -0700 (PDT)
From:	David Rientjes <rientjes@...gle.com>
To:	Joonsoo Kim <iamjoonsoo.kim@....com>
cc:	Pekka Enberg <penberg@...nel.org>,
	Christoph Lameter <cl@...ux.com>,
	Andrew Morton <akpm@...ux-foundation.org>, linux-mm@...ck.org,
	linux-kernel@...r.kernel.org, Joonsoo Kim <js1304@...il.com>
Subject: Re: [PATCH v2 05/10] slab: factor out initialization of arracy
 cache

On Wed, 7 May 2014, Joonsoo Kim wrote:

> Factor out initialization of array cache to use it in following patch.
> 
> Acked-by: Christoph Lameter <cl@...ux.com>
> Signed-off-by: Joonsoo Kim <iamjoonsoo.kim@....com>
> 

Acked-by: David Rientjes <rientjes@...gle.com>

s/arracy/array/ in patch title.

> diff --git a/mm/slab.c b/mm/slab.c
> index 7647728..755fb57 100644
> --- a/mm/slab.c
> +++ b/mm/slab.c
> @@ -741,13 +741,8 @@ static void start_cpu_timer(int cpu)
>  	}
>  }
>  
> -static struct array_cache *alloc_arraycache(int node, int entries,
> -					    int batchcount, gfp_t gfp)
> +static void init_arraycache(struct array_cache *ac, int limit, int batch)
>  {
> -	int memsize = sizeof(void *) * entries + sizeof(struct array_cache);
> -	struct array_cache *nc = NULL;
> -
> -	nc = kmalloc_node(memsize, gfp, node);
>  	/*
>  	 * The array_cache structures contain pointers to free object.
>  	 * However, when such objects are allocated or transferred to another
> @@ -755,15 +750,25 @@ static struct array_cache *alloc_arraycache(int node, int entries,
>  	 * valid references during a kmemleak scan. Therefore, kmemleak must
>  	 * not scan such objects.
>  	 */
> -	kmemleak_no_scan(nc);
> -	if (nc) {
> -		nc->avail = 0;
> -		nc->limit = entries;
> -		nc->batchcount = batchcount;
> -		nc->touched = 0;
> -		spin_lock_init(&nc->lock);
> +	kmemleak_no_scan(ac);
> +	if (ac) {
> +		ac->avail = 0;
> +		ac->limit = limit;
> +		ac->batchcount = batch;
> +		ac->touched = 0;
> +		spin_lock_init(&ac->lock);
>  	}
> -	return nc;
> +}
> +
> +static struct array_cache *alloc_arraycache(int node, int entries,
> +					    int batchcount, gfp_t gfp)
> +{
> +	int memsize = sizeof(void *) * entries + sizeof(struct array_cache);

const?

> +	struct array_cache *ac = NULL;
> +
> +	ac = kmalloc_node(memsize, gfp, node);

I thought nc meant node cache, but I agree that ac is clearer.

> +	init_arraycache(ac, entries, batchcount);
> +	return ac;
>  }
>  
>  static inline bool is_slab_pfmemalloc(struct page *page)
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@...r.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ