Received: by 2002:a05:6a10:8c0a:0:0:0:0 with SMTP id go10csp1322849pxb; Fri, 22 Jan 2021 12:37:41 -0800 (PST) X-Google-Smtp-Source: ABdhPJwp9lyJd6/C86bmLPxBFv4sEqQMJ2+qlHOOubZO++f9epzSCvlTxnNzLT5XlyTh9cQ5Hq/v X-Received: by 2002:a17:906:858f:: with SMTP id v15mr4102601ejx.238.1611347861614; Fri, 22 Jan 2021 12:37:41 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1611347861; cv=none; d=google.com; s=arc-20160816; b=QXxz++1ljSC2OEctQPrn0neWpPWbu9sqEWSBjI+Y3mKn3OtCfxeiW4gZWZqAfbA6TG kJ8ejHRZcR5ez9x7ph8eGB24s+T74xQ4arjUyFFaJeWuVjD3keGKTOa2p6tmgpwOo4Di poSL6fO6u3Hk4zTpzaZZJBQftp5jYpoc4M9EbMb/WqCaE43Unp+0sI6+S3kAb6MR2d9I N1IdZiUFDN8FsOzOdIfsR8LL+9TN/WXZeN8O57aeyDjzt2cv0H3PRfn4f4nmV524ZWhv mDLD5NKyxGMy/ZoMs9UockxI9hedbF78XKOaDoRqOEjfeP56jQZgp/r++tyjbyv8IxZt wpFQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:from:user-agent:in-reply-to:content-disposition :mime-version:references:message-id:subject:cc:to:date :dkim-signature:dkim-filter; bh=2K3r/xAZaFHf9jaE/1JNYwDtbcaplDLMe1MvsCxl1os=; b=XWkOSiHB16nrI9wn0aIQbIfyGD1iZxaeiGZPw1kafwHf7uC+NK5tcYGWAbz6cHJAom lriRMT7cc29HKLYPApZ2KC4RwL4SQbF7TyvTobBpewxAMuu24rDPciqJRi4UroTVc6Nv jy0QDVrR+9VCbdKTOXY7CxQOIfmld+u+ZBCgOic3V4Yj2SlQCuNoeOPHNijVdjso3oED 0RtGhezIygerTT4PIit3g1sn2W4OyON/DSy2HB+0Pps3UalqNCueqF8JM9Cw0bC1cPKw sWCodIBKbI5c/6CcCD2y+cJqDTtY2LD2vN+1Cc2G7Gf/GI1OpRZtWdQH7Qf70OXHk4z0 FL1A== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@fieldses.org header.s=default header.b=pKnR2xGs; 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 e12si4267220edc.322.2021.01.22.12.37.12; Fri, 22 Jan 2021 12:37:41 -0800 (PST) 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=pKnR2xGs; 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 S1730192AbhAVUgE (ORCPT + 99 others); Fri, 22 Jan 2021 15:36:04 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:46276 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1729722AbhAVUfN (ORCPT ); Fri, 22 Jan 2021 15:35:13 -0500 Received: from fieldses.org (fieldses.org [IPv6:2600:3c00:e000:2f7::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id A6277C061786 for ; Fri, 22 Jan 2021 12:34:33 -0800 (PST) Received: by fieldses.org (Postfix, from userid 2815) id 143086E97; Fri, 22 Jan 2021 15:34:32 -0500 (EST) DKIM-Filter: OpenDKIM Filter v2.11.0 fieldses.org 143086E97 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=fieldses.org; s=default; t=1611347672; bh=2K3r/xAZaFHf9jaE/1JNYwDtbcaplDLMe1MvsCxl1os=; h=Date:To:Cc:Subject:References:In-Reply-To:From:From; b=pKnR2xGsm6FCjn6ekB4aBSJxjjUHtOzU6eybsAVI8QBwTotGhPl6kgMPytwjpZZuW NkrcfTBmNZ57aVrujDreLTBnj++UjzLzriPnwceP2p69Xc7pe5hJgo5DRJqf6+P7GQ weomzI19wHvq3e5/Xpr6kqHS6yPFE14mHQP5i3VA= Date: Fri, 22 Jan 2021 15:34:32 -0500 To: Chuck Lever Cc: linux-nfs@vger.kernel.org Subject: Re: [PATCH RFC] NFSD: Reduce svc_rqst::rq_pages churn during READDIR operations Message-ID: <20210122203432.GA25405@fieldses.org> References: <161134687025.19311.4882007133082076189.stgit@klimt.1015granger.net> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <161134687025.19311.4882007133082076189.stgit@klimt.1015granger.net> User-Agent: Mutt/1.5.21 (2010-09-15) From: bfields@fieldses.org (J. Bruce Fields) Precedence: bulk List-ID: X-Mailing-List: linux-nfs@vger.kernel.org Makes sense to me.--b. On Fri, Jan 22, 2021 at 03:21:10PM -0500, Chuck Lever wrote: > During NFSv2 and NFSv3 READDIR/PLUS operations, NFSD advances > rq_next_page to the full size of the client-requested buffer, then > releases all those pages at the end of the request. The next request > to use that nfsd thread has to refill the pages. > > NFSD does this even when the dirlist in the reply is small. With > NFSv3 clients that send READDIR operations with large buffer sizes, > that can be 256 put_page/alloc_page pairs per READDIR request, even > though those pages often remain unused. > > We can save some work by not releasing dirlist buffer pages that > were not used to form the READDIR Reply. I've left the NFSv2 code > alone since there are never more than three pages involved in an > NFSv2 READDIR operation. > > Eventually we should nail down why these pages need to be released > at all in order to avoid allocating and releasing pages > unnecessarily. > > Signed-off-by: Chuck Lever > --- > fs/nfsd/nfs3proc.c | 2 ++ > 1 file changed, 2 insertions(+) > > diff --git a/fs/nfsd/nfs3proc.c b/fs/nfsd/nfs3proc.c > index 8675851199f8..569bfff314f0 100644 > --- a/fs/nfsd/nfs3proc.c > +++ b/fs/nfsd/nfs3proc.c > @@ -492,6 +492,7 @@ nfsd3_proc_readdir(struct svc_rqst *rqstp) > } > count += PAGE_SIZE; > } > + rqstp->rq_next_page = p; > resp->count = count >> 2; > if (resp->offset) { > if (unlikely(resp->offset1)) { > @@ -557,6 +558,7 @@ nfsd3_proc_readdirplus(struct svc_rqst *rqstp) > } > count += PAGE_SIZE; > } > + rqstp->rq_next_page = p; > resp->count = count >> 2; > if (resp->offset) { > if (unlikely(resp->offset1)) { >