lkml.org 
[lkml]   [2020]   [Jun]   [17]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
/
SubjectRe: [PATCH] mm, slab: Use kmem_cache_zalloc() instead of kmem_cache_alloc() with flag GFP_ZERO.
From
Date
On 6/17/20 9:15 AM, Yi Wang wrote:
> From: Liao Pingfang <liao.pingfang@zte.com.cn>
>
> Use kmem_cache_zalloc instead of manually calling kmem_cache_alloc
> with flag GFP_ZERO.
>
> Signed-off-by: Liao Pingfang <liao.pingfang@zte.com.cn>
> ---
> include/linux/slab.h | 2 +-
> 1 file changed, 1 insertion(+), 1 deletion(-)
>
> diff --git a/include/linux/slab.h b/include/linux/slab.h
> index 6d45488..1fa62d9 100644
> --- a/include/linux/slab.h
> +++ b/include/linux/slab.h
> @@ -656,7 +656,7 @@ extern void *__kmalloc_node_track_caller(size_t, gfp_t, int, unsigned long);
> */
> static inline void *kmem_cache_zalloc(struct kmem_cache *k, gfp_t flags)
> {
> - return kmem_cache_alloc(k, flags | __GFP_ZERO);
> + return kmem_cache_zalloc(k, flags);

Did you test this patch?

> }
>
> /**
>

\
 
 \ /
  Last update: 2020-06-17 12:44    [W:0.039 / U:2.256 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site