linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
To: linux-kernel@vger.kernel.org
Cc: "Greg Kroah-Hartman" <gregkh@linuxfoundation.org>,
	stable@vger.kernel.org, "Rik van Riel" <riel@surriel.com>,
	"J. Bruce Fields" <bfields@redhat.com>,
	"Krzysztof Olędzki" <ole@ans.pl>
Subject: [PATCH 5.4 15/16] silence nfscache allocation warnings with kvzalloc
Date: Fri,  8 Oct 2021 13:28:05 +0200	[thread overview]
Message-ID: <20211008112715.984293302@linuxfoundation.org> (raw)
In-Reply-To: <20211008112715.444305067@linuxfoundation.org>

From: Rik van Riel <riel@surriel.com>

commit 8c38b705b4f4ca4e7f9cc116141bc38391917c30 upstream.

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>
Cc: Krzysztof Olędzki <ole@ans.pl>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
---
 fs/nfsd/nfscache.c |   12 ++++--------
 1 file changed, 4 insertions(+), 8 deletions(-)

--- a/fs/nfsd/nfscache.c
+++ b/fs/nfsd/nfscache.c
@@ -173,14 +173,10 @@ int nfsd_reply_cache_init(struct nfsd_ne
 	if (status)
 		goto out_nomem;
 
-	nn->drc_hashtbl = kcalloc(hashsize,
-				sizeof(*nn->drc_hashtbl), GFP_KERNEL);
-	if (!nn->drc_hashtbl) {
-		nn->drc_hashtbl = vzalloc(array_size(hashsize,
-						 sizeof(*nn->drc_hashtbl)));
-		if (!nn->drc_hashtbl)
-			goto out_shrinker;
-	}
+	nn->drc_hashtbl = kvzalloc(array_size(hashsize,
+				sizeof(*nn->drc_hashtbl)), GFP_KERNEL);
+	if (!nn->drc_hashtbl)
+		goto out_shrinker;
 
 	for (i = 0; i < hashsize; i++) {
 		INIT_LIST_HEAD(&nn->drc_hashtbl[i].lru_head);



  parent reply	other threads:[~2021-10-08 11:32 UTC|newest]

Thread overview: 22+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-10-08 11:27 [PATCH 5.4 00/16] 5.4.152-rc1 review Greg Kroah-Hartman
2021-10-08 11:27 ` [PATCH 5.4 01/16] net: mdio: introduce a shutdown method to mdio device drivers Greg Kroah-Hartman
2021-10-08 11:27 ` [PATCH 5.4 02/16] xen-netback: correct success/error reporting for the SKB-with-fraglist case Greg Kroah-Hartman
2021-10-08 11:27 ` [PATCH 5.4 03/16] sparc64: fix pci_iounmap() when CONFIG_PCI is not set Greg Kroah-Hartman
2021-10-08 11:27 ` [PATCH 5.4 04/16] ext2: fix sleeping in atomic bugs on error Greg Kroah-Hartman
2021-10-08 11:27 ` [PATCH 5.4 05/16] scsi: sd: Free scsi_disk device via put_device() Greg Kroah-Hartman
2021-10-08 11:27 ` [PATCH 5.4 06/16] usb: testusb: Fix for showing the connection speed Greg Kroah-Hartman
2021-10-08 11:27 ` [PATCH 5.4 07/16] usb: dwc2: check return value after calling platform_get_resource() Greg Kroah-Hartman
2021-10-08 11:27 ` [PATCH 5.4 08/16] selftests: be sure to make khdr before other targets Greg Kroah-Hartman
2021-10-08 11:27 ` [PATCH 5.4 09/16] selftests:kvm: fix get_warnings_count() ignoring fscanf() return warn Greg Kroah-Hartman
2021-10-08 11:28 ` [PATCH 5.4 10/16] scsi: ses: Retry failed Send/Receive Diagnostic commands Greg Kroah-Hartman
2021-10-08 11:28 ` [PATCH 5.4 11/16] tools/vm/page-types: remove dependency on opt_file for idle page tracking Greg Kroah-Hartman
2021-10-08 11:28 ` [PATCH 5.4 12/16] KVM: do not shrink halt_poll_ns below grow_start Greg Kroah-Hartman
2021-10-08 11:28 ` [PATCH 5.4 13/16] kvm: x86: Add AMD PMU MSRs to msrs_to_save_all[] Greg Kroah-Hartman
2021-10-08 11:28 ` [PATCH 5.4 14/16] perf/x86: Reset destroy callback on event init failure Greg Kroah-Hartman
2021-10-08 11:28 ` Greg Kroah-Hartman [this message]
2021-10-08 11:28 ` [PATCH 5.4 16/16] libata: Add ATA_HORKAGE_NO_NCQ_ON_ATI for Samsung 860 and 870 SSD Greg Kroah-Hartman
2021-10-08 19:23 ` [PATCH 5.4 00/16] 5.4.152-rc1 review Florian Fainelli
2021-10-08 20:47 ` Shuah Khan
2021-10-08 20:47 ` Shuah Khan
2021-10-08 21:04 ` Guenter Roeck
2021-10-09  4:35 ` Naresh Kamboju

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20211008112715.984293302@linuxfoundation.org \
    --to=gregkh@linuxfoundation.org \
    --cc=bfields@redhat.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=ole@ans.pl \
    --cc=riel@surriel.com \
    --cc=stable@vger.kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).