Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

silence nfscache allocation warnings with kvzalloc

silence nfscache allocation warnings with kvzalloc

Currently nfsd_reply_cache_init attempts hash table allocation through
kmalloc, and manually falls back to vzalloc if that fails. This makes
the code a little larger than needed, and creates a significant amount
of serial console spam if you have enough systems.

Switching to kvzalloc gets rid of the allocation warnings, and makes
the code a little cleaner too as a side effect.

Freeing of nn->drc_hashtbl is already done using kvfree currently.

Signed-off-by: Rik van Riel <riel@surriel.com>
Signed-off-by: J. Bruce Fields <bfields@redhat.com>

authored by

Rik van Riel and committed by
J. Bruce Fields
8c38b705 44b49aa6

+4 -8
+4 -8
fs/nfsd/nfscache.c
··· 172 172 if (status) 173 173 goto out_nomem; 174 174 175 - nn->drc_hashtbl = kcalloc(hashsize, 176 - sizeof(*nn->drc_hashtbl), GFP_KERNEL); 177 - if (!nn->drc_hashtbl) { 178 - nn->drc_hashtbl = vzalloc(array_size(hashsize, 179 - sizeof(*nn->drc_hashtbl))); 180 - if (!nn->drc_hashtbl) 181 - goto out_shrinker; 182 - } 175 + nn->drc_hashtbl = kvzalloc(array_size(hashsize, 176 + sizeof(*nn->drc_hashtbl)), GFP_KERNEL); 177 + if (!nn->drc_hashtbl) 178 + goto out_shrinker; 183 179 184 180 for (i = 0; i < hashsize; i++) { 185 181 INIT_LIST_HEAD(&nn->drc_hashtbl[i].lru_head);