[Devel] [PATCH vz7] nfsd: use kvzalloc() to allocate memory for drc_hashtbl

Oleg Babin obabin at virtuozzo.com
Thu May 10 20:06:49 MSK 2018


Please ignore this patch as it will be superseded with v2 patchset.

On 05/10/2018 06:09 PM, Oleg Babin wrote:
> The size of drc_hashtbl depends on totalram_pages and totalhigh_pages
> mm variables and limited to 96k which means 5th memory order.
> 
> Use kvzalloc() for drc_hashtbl allocation to fallback to vmalloc()
> in case of high order page is not available at the moment.
> 
> https://jira.sw.ru/browse/PSBM-84234
> Signed-off-by: Oleg Babin <obabin at virtuozzo.com>
> ---
>  fs/nfsd/nfscache.c | 4 ++--
>  1 file changed, 2 insertions(+), 2 deletions(-)
> 
> diff --git a/fs/nfsd/nfscache.c b/fs/nfsd/nfscache.c
> index a4fa08e..7f64b20 100644
> --- a/fs/nfsd/nfscache.c
> +++ b/fs/nfsd/nfscache.c
> @@ -177,7 +177,7 @@ int nfsd_reply_cache_init(void)
>  	if (!drc_slab)
>  		goto out_nomem;
>  
> -	drc_hashtbl = kcalloc(hashsize, sizeof(*drc_hashtbl), GFP_KERNEL);
> +	drc_hashtbl = kvzalloc(hashsize * sizeof(*drc_hashtbl), GFP_KERNEL);
>  	if (!drc_hashtbl)
>  		goto out_nomem;
>  	for (i = 0; i < hashsize; i++) {
> @@ -209,7 +209,7 @@ void nfsd_reply_cache_shutdown(void)
>  		}
>  	}
>  
> -	kfree (drc_hashtbl);
> +	kvfree(drc_hashtbl);
>  	drc_hashtbl = NULL;
>  	drc_hashsize = 0;
>  
> 


-- 
Best regards,
Oleg Babin


More information about the Devel mailing list