Received: by 2002:a05:6a10:22f:0:0:0:0 with SMTP id 15csp2321487pxk; Mon, 14 Sep 2020 10:09:00 -0700 (PDT) X-Google-Smtp-Source: ABdhPJzEwPDHFf7lMzwDCGieKtf2Xe6sJmQQvYZtIvZDvXR6MvBK7wJ+yqBgdnYsUhatV+d7Sfu8 X-Received: by 2002:a17:906:934e:: with SMTP id p14mr15479466ejw.348.1600103340108; Mon, 14 Sep 2020 10:09:00 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1600103340; cv=none; d=google.com; s=arc-20160816; b=s992w69lDtx3iy7k+eoUwHmar/OQxw5zyR7QL19AeTLRKN9sGGvY7tkRAgzIDG/HTg TBhqo2VMerzSHpwcgQ34kjs0QlAq2hawlWBJf3lR0rh0ppqSF+MGubdbU0y4dM3gKvb+ UmjIL6n+vHrrWmDK4faIjGTIgt1ZV9iIlhBWBmH8f+9FgkVjntWRHC4NLhLte56qULUd 23jRw0WhA/WiLRglsKSLWvmLDD7pFU0AescWy4MOmOM/MAcQIvUp6/nq4gcPQheiole/ RlS6eK6SzznfFsw0QIxyWHD66EFFO4eKRwurK0AtY2x+vYzZewyzGujk7zEYJvvJv0TG yNqA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:content-transfer-encoding:mime-version :message-id:subject:cc:to:from:date; bh=B+2V4H19TJWBfGkD82aKY9QtD3WDOBYBaJv8uUWmKx0=; b=G5nfiT2VmTH2qURjmdQxyh+7OvjrS+fWiUekQN9B3YE7qHFwI9jAhdsQmy2pdXMQgx kTWYoIEwudlfkwCmufG+kBufpinOI4HRV9omhIsouIP4Rpfi5YafVHdiulhdNhxl0qew mAvziXIGMrl29hBOxD4ssH3LLFzywgEtz+HD7PxsCVfYS+emDD6++ujLKaQVsVF35L16 BE07imfR6hPvEIhKXyTLF8yXDiONm6lB+hT9vsvFxu5GzlypHaAip62qUa/teCoQLBEs zbJMRJtxDc5M8w0hXtUn8UBx8s+kaWtKVW4kh32I/Mekkq52ljWxySc6Zo25pedgewJ0 C/xQ== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id cd7si7465050ejb.433.2020.09.14.10.08.37; Mon, 14 Sep 2020 10:09:00 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1726064AbgINRHq (ORCPT + 99 others); Mon, 14 Sep 2020 13:07:46 -0400 Received: from shelob.surriel.com ([96.67.55.147]:47224 "EHLO shelob.surriel.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1725961AbgINRHb (ORCPT ); Mon, 14 Sep 2020 13:07:31 -0400 Received: from [2603:3005:d05:2b00:6e0b:84ff:fee2:98bb] (helo=imladris.surriel.com) by shelob.surriel.com with esmtpsa (TLS1.2) tls TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384 (Exim 4.94) (envelope-from ) id 1kHrwn-0006gu-1u; Mon, 14 Sep 2020 13:07:21 -0400 Date: Mon, 14 Sep 2020 13:07:19 -0400 From: Rik van Riel To: "J. Bruce Fields" Cc: Chuck Lever , linux-nfs@vger.kernel.org, linux-kernel@vger.kernel.org, kernel-team@fb.com Subject: [PATCH] silence nfscache allocation warnings with kvzalloc Message-ID: <20200914130719.247cccb0@imladris.surriel.com> X-Mailer: Claws Mail 3.17.6 (GTK+ 2.24.32; x86_64-redhat-linux-gnu) MIME-Version: 1.0 Content-Type: text/plain; charset=US-ASCII Content-Transfer-Encoding: 7bit Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org 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 --- diff --git a/fs/nfsd/nfscache.c b/fs/nfsd/nfscache.c index 96352ab7bd81..5125b5ef25b6 100644 --- a/fs/nfsd/nfscache.c +++ b/fs/nfsd/nfscache.c @@ -164,14 +164,10 @@ int nfsd_reply_cache_init(struct nfsd_net *nn) if (!nn->drc_slab) goto out_shrinker; - 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_slab; - } + nn->drc_hashtbl = kvzalloc(array_size(hashsize, + sizeof(*nn->drc_hashtbl)), GFP_KERNEL); + if (!nn->drc_hashtbl) + goto out_slab; for (i = 0; i < hashsize; i++) { INIT_LIST_HEAD(&nn->drc_hashtbl[i].lru_head);