Received: by 2002:a05:6a10:22f:0:0:0:0 with SMTP id 15csp2445382pxk; Mon, 14 Sep 2020 13:37:25 -0700 (PDT) X-Google-Smtp-Source: ABdhPJyWuEjDBUh+BhnOVby2KAX3dStDSqi6uKRuTnhEKuwiisJXiMxJDhB/6W41rIsHxRgQniZh X-Received: by 2002:a50:cf0b:: with SMTP id c11mr18582042edk.87.1600115845460; Mon, 14 Sep 2020 13:37:25 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1600115845; cv=none; d=google.com; s=arc-20160816; b=xP9r4DqRCOR6TJf4xGKjv5d0QfwEYOEu8aI4Fykenea1GOkjkaXXhJrz1pdNc6bgZi 0Wwwj02C2y2pG+w6Fx/zsvL0l7Fz2a7JFoY8gJdj0/EisA2XX3oLclmuHRHgrkXJd98k VrWRxcAJSi6fPtYQmKEOBi6EeJFTP8rZN0VK9o0QwtoLyfYqY9xG0R6VQCQ/+sbSJDV6 qQ8MfpS+kwWu5wUSmE1OZRtyDx6e4E6vJcqHsRIobuRPENoYYxNNUWZH2y6IBjmyH2Iy I7vR74wUT5f1LBTcLoWmmOMzDsVYK7AIY3Osj61oQcU5g5bC9jM8PdNDme/uSKXAhKK0 EQHA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:user-agent:in-reply-to :content-disposition:mime-version:references:message-id:subject:cc :to:from:date:dkim-signature:dkim-filter; bh=XmXX13dDwCtwDS9GIOR/1zXwwSIFQOW0jwJ0UAz4XIY=; b=yFlgG8bM/FSuCVWd5RqEiQx6ldx927nKM6CrDnRSpWDUBktDxKYGwVyvYTfi4thSq/ dkygdtuEBFT8B6mI1FMbcoendoYAug6iccC02ykTcdBh1hcdtPdge4gmmgVKkd7puBuV y5qbCFOieKW/eZ9xuXa5KjBDQ3IBIvYbzve4r4Lwa8yWDUsUOZ7aXZ63Ud7W5D2o7bKe VGRTaDWhC22755vJ7J3xf5avyV+ArB8kSHQdFpAAueAuUbncXIqCPa4hpFl5GyjHEiN3 6K5KPbMHDoOo5Z67dnKJhh/co/5aYbqWAEc0TuGj1VX/9Cd6e9n+ADL2J9TLwn2AIvhq Z24Q== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@fieldses.org header.s=default header.b=mz7fO1v5; spf=pass (google.com: domain of linux-nfs-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-nfs-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 q26si8178779eji.610.2020.09.14.13.36.53; Mon, 14 Sep 2020 13:37:25 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-nfs-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; dkim=pass header.i=@fieldses.org header.s=default header.b=mz7fO1v5; spf=pass (google.com: domain of linux-nfs-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-nfs-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1726031AbgINUgi (ORCPT + 99 others); Mon, 14 Sep 2020 16:36:38 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:38428 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1725979AbgINUga (ORCPT ); Mon, 14 Sep 2020 16:36:30 -0400 Received: from fieldses.org (fieldses.org [IPv6:2600:3c00:e000:2f7::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 06375C06174A; Mon, 14 Sep 2020 13:36:29 -0700 (PDT) Received: by fieldses.org (Postfix, from userid 2815) id 2712BBC3; Mon, 14 Sep 2020 16:36:28 -0400 (EDT) DKIM-Filter: OpenDKIM Filter v2.11.0 fieldses.org 2712BBC3 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=fieldses.org; s=default; t=1600115788; bh=XmXX13dDwCtwDS9GIOR/1zXwwSIFQOW0jwJ0UAz4XIY=; h=Date:From:To:Cc:Subject:References:In-Reply-To:From; b=mz7fO1v5YhmRe+BgXn04HmtMBy9NFm6g0zQAJT8IGhfUNT+sXmTOcrP5aIugGx/k2 QpuKHh/K5YwNUWP4ABOEKnrD8OCg9+s1PHFNwUCG92ii1bAcbvnUgtUNDavrUwtZSN f+q4nKjP98/l/lk49jD3NtEH6vXLl8/2rLfAZIko= Date: Mon, 14 Sep 2020 16:36:28 -0400 From: "J. Bruce Fields" To: Rik van Riel Cc: Chuck Lever , linux-nfs@vger.kernel.org, linux-kernel@vger.kernel.org, kernel-team@fb.com Subject: Re: [PATCH] silence nfscache allocation warnings with kvzalloc Message-ID: <20200914203628.GC30007@fieldses.org> References: <20200914130719.247cccb0@imladris.surriel.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20200914130719.247cccb0@imladris.surriel.com> User-Agent: Mutt/1.5.21 (2010-09-15) Sender: linux-nfs-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-nfs@vger.kernel.org Applying, thanks.--b. On Mon, Sep 14, 2020 at 01:07:19PM -0400, Rik van Riel wrote: > 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);