The commit is pushed to "branch-rh7-3.10.0-693.21.1.vz7.47.x-ovz" and will 
appear at
after rh7-3.10.0-693.21.1.vz7.47.6
commit b57f616135d1e25506f84cbf3637ec369c510d08
Author: Oleg Babin <>
Date:   Wed May 16 11:18:13 2018 +0300

    nfsd: use kvzalloc() to allocate memory for drc_hashtbl
    The original code uses vzalloc() directly as a fallback path if
    the allocation with kcalloc() failed. But in this case a warning
    about memory allocation failure will be generated even in case
    when the fallback path succeeds. Also kcalloc() can involve retries
    and OOM killer which is undesireable.
    kvzalloc() handles all these aspects properly.
    Signed-off-by: Oleg Babin <>
    Reviewed-by: Andrey Ryabinin <>
    Patchset description:
    nfsd: use kvzalloc() to allocate memory for drc_hashtbl
    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.
    v2: Make use of the mainstream patch which partially fixes the problem.
    Jeff Layton (1):
      nfsd: more robust allocation failure handling in nfsd_reply_cache_init
    Oleg Babin (1):
      nfsd: use kvzalloc() to allocate memory for drc_hashtbl
 fs/nfsd/nfscache.c | 9 +++------
 1 file changed, 3 insertions(+), 6 deletions(-)

diff --git a/fs/nfsd/nfscache.c b/fs/nfsd/nfscache.c
index b5c25eaeaae2..f65090a5e7d7 100644
--- a/fs/nfsd/nfscache.c
+++ b/fs/nfsd/nfscache.c
@@ -178,12 +178,9 @@ int nfsd_reply_cache_init(void)
        if (!drc_slab)
                goto out_nomem;
-       drc_hashtbl = kcalloc(hashsize, sizeof(*drc_hashtbl), GFP_KERNEL);
-       if (!drc_hashtbl) {
-               drc_hashtbl = vzalloc(hashsize * sizeof(*drc_hashtbl));
-               if (!drc_hashtbl)
-                       goto out_nomem;
-       }
+       drc_hashtbl = kvzalloc(hashsize * sizeof(*drc_hashtbl), GFP_KERNEL);
+       if (!drc_hashtbl)
+               goto out_nomem;
        for (i = 0; i < hashsize; i++) {
Devel mailing list

Reply via email to