Received: by 2002:a05:6a10:f3d0:0:0:0:0 with SMTP id a16csp548691pxv; Thu, 8 Jul 2021 08:27:09 -0700 (PDT) X-Google-Smtp-Source: ABdhPJwv0WVeE3QgB9ehmk+RRUhYvLotk+r7Xi6r5FrgYzYKlVr3ZnAhROZjvELavjR/xmV3mljW X-Received: by 2002:a17:906:4fce:: with SMTP id i14mr21745800ejw.231.1625758029079; Thu, 08 Jul 2021 08:27:09 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1625758029; cv=none; d=google.com; s=arc-20160816; b=Aq6diEGzlJ/lKZ+bnF1Tdty3FJoygxW3r8VyKiV6YU84A9JO3N7q5i0LFTC2Lp0Dtz L7YP9Z15GnaEEFoxvV+SY+vxIsUbesAFFXpT5+zEc2/azQ1bnyQLA9Ko/YMjjauquETy PIQLLupWy4lMP6cpZXP8ayNGNTHaGPYD6PeYAW9SBgnPyZ5NRGpdqGwHE4RPQ04CFqro gTroNoQLDyAcEymRbedVLufjjD3bn9P+MFyvgAaB/1RTSKmn7+RlQtSSSr8vdBMEhTWz OwAHR7oy1Bg/LgUqdB5ZLTAJCqT7TXWMcmzJHXW7E5QvK0BbDb2KZvE5jDglcjqvCIMS 4dWQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :user-agent:references:in-reply-to:message-id:date:cc:to:from :subject; bh=BkBlIbXL/vzE/sjRvqZ3jqRnW+Rza1S5I/r96PTeuRE=; b=iFL34kckrL8gM/BW5ljMHPaIed6pgSWer0372c+M1pg7tQJvuW3bfzWBpbwpJ8XsXc LeArvxaVMuG24NOnZSYb49TrMgfh3SeIyPUfktyBWx7IN8JfjVhkZL4i0ssF5mN4/ZNO hEZJhCGem+12a4yX7OHKn+FTgRCgs/JB8WjePGpL3zh2l7pzlCHy0ueuG64s5XS75tgT OIELnHeLpl2MNVwGaxpqIBs+wD14ZCmKKTqLyM8Zbi9MTgIjXUOeyRmoesRevcY+Ak1e 7vEdeGx1y0D3z4ItUafKj/s4QLqKp5Yk9oFUd69kjgd2x8oJfz8JHjzLKltR0QwmdgoQ A9vw== ARC-Authentication-Results: i=1; mx.google.com; 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; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=oracle.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id p8si3871752edj.155.2021.07.08.08.26.46; Thu, 08 Jul 2021 08:27:09 -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; 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; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=oracle.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S231932AbhGHP3S (ORCPT + 99 others); Thu, 8 Jul 2021 11:29:18 -0400 Received: from mail.kernel.org ([198.145.29.99]:51174 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S231804AbhGHP3S (ORCPT ); Thu, 8 Jul 2021 11:29:18 -0400 Received: by mail.kernel.org (Postfix) with ESMTPSA id F3F1161459; Thu, 8 Jul 2021 15:26:35 +0000 (UTC) Subject: [PATCH v3 3/3] NFSD: Batch release pages during splice read From: Chuck Lever To: linux-nfs@vger.kernel.org, linux-mm@kvack.org Cc: neilb@suse.de Date: Thu, 08 Jul 2021 11:26:35 -0400 Message-ID: <162575799527.2532.9850430992854215546.stgit@klimt.1015granger.net> In-Reply-To: <162575623717.2532.8517369487503961860.stgit@klimt.1015granger.net> References: <162575623717.2532.8517369487503961860.stgit@klimt.1015granger.net> User-Agent: StGit/1.1 MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: 7bit Precedence: bulk List-ID: X-Mailing-List: linux-nfs@vger.kernel.org Large splice reads call put_page() repeatedly. put_page() is relatively expensive to call, so replace it with the new svc_rqst_replace_page() helper to help amortize that cost. Signed-off-by: Chuck Lever --- fs/nfsd/vfs.c | 9 ++------- 1 file changed, 2 insertions(+), 7 deletions(-) diff --git a/fs/nfsd/vfs.c b/fs/nfsd/vfs.c index da5340dc0203..43ac23b200d2 100644 --- a/fs/nfsd/vfs.c +++ b/fs/nfsd/vfs.c @@ -849,15 +849,10 @@ nfsd_splice_actor(struct pipe_inode_info *pipe, struct pipe_buffer *buf, struct page *page = buf->page; if (rqstp->rq_res.page_len == 0) { - get_page(page); - put_page(*rqstp->rq_next_page); - *(rqstp->rq_next_page++) = page; + svc_rqst_replace_page(rqstp, page); rqstp->rq_res.page_base = buf->offset; } else if (page != pp[-1]) { - get_page(page); - if (*rqstp->rq_next_page) - put_page(*rqstp->rq_next_page); - *(rqstp->rq_next_page++) = page; + svc_rqst_replace_page(rqstp, page); } rqstp->rq_res.page_len += sd->len;