[Devel] [PATCH vz7] nfsd: use kvzalloc() to allocate memory for drc_hashtbl
Oleg Babin
obabin at virtuozzo.com
Thu May 10 18:09:20 MSK 2018
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;
--
1.8.3.1
More information about the Devel
mailing list