From patchwork Sat Apr 15 00:18:15 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Chuck Lever X-Patchwork-Id: 13212219 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from kanga.kvack.org (kanga.kvack.org [205.233.56.17]) by smtp.lore.kernel.org (Postfix) with ESMTP id 42CCBC77B72 for ; Sat, 15 Apr 2023 00:18:20 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id DD687900007; Fri, 14 Apr 2023 20:18:19 -0400 (EDT) Received: by kanga.kvack.org (Postfix, from userid 40) id D85DA900002; Fri, 14 Apr 2023 20:18:19 -0400 (EDT) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id C74D9900007; Fri, 14 Apr 2023 20:18:19 -0400 (EDT) X-Delivered-To: linux-mm@kvack.org Received: from relay.hostedemail.com (smtprelay0015.hostedemail.com [216.40.44.15]) by kanga.kvack.org (Postfix) with ESMTP id BA920900002 for ; Fri, 14 Apr 2023 20:18:19 -0400 (EDT) Received: from smtpin15.hostedemail.com (a10.router.float.18 [10.200.18.1]) by unirelay07.hostedemail.com (Postfix) with ESMTP id 913501604D9 for ; Sat, 15 Apr 2023 00:18:19 +0000 (UTC) X-FDA: 80681713518.15.361492D Received: from dfw.source.kernel.org (dfw.source.kernel.org [139.178.84.217]) by imf11.hostedemail.com (Postfix) with ESMTP id 02FBC4001C for ; Sat, 15 Apr 2023 00:18:17 +0000 (UTC) Authentication-Results: imf11.hostedemail.com; dkim=pass header.d=kernel.org header.s=k20201202 header.b=q30o4mYF; spf=pass (imf11.hostedemail.com: domain of cel@kernel.org designates 139.178.84.217 as permitted sender) smtp.mailfrom=cel@kernel.org; dmarc=pass (policy=none) header.from=kernel.org ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=hostedemail.com; s=arc-20220608; t=1681517898; h=from:from:sender:reply-to:subject:subject:date:date: message-id:message-id:to:to:cc:mime-version:mime-version: content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references:dkim-signature; bh=rpGrvsjXX0roeYU4i8chRr4Z9mJdVW+uPcunqIcdMC4=; b=4piywo8lYl+dyNXqwScyd/rMUi5sZsJUCC2q2/NNZK9+VDSFfT5/Igz4GcJe1mNbUjnZpW EU207Av5XygFmNSex3FuwpOPXd4jN4rwEZG1vYRlVarmyv78xsqruLXy6cnmU6QqeMkCvX GQcC9ZGkAkq6Heu2qASJDEIWy8ZiUgc= ARC-Authentication-Results: i=1; imf11.hostedemail.com; dkim=pass header.d=kernel.org header.s=k20201202 header.b=q30o4mYF; spf=pass (imf11.hostedemail.com: domain of cel@kernel.org designates 139.178.84.217 as permitted sender) smtp.mailfrom=cel@kernel.org; dmarc=pass (policy=none) header.from=kernel.org ARC-Seal: i=1; s=arc-20220608; d=hostedemail.com; t=1681517898; a=rsa-sha256; cv=none; b=Nj7xRJ9JQQYBZXTsCmZZPf4230H0TWD34SWfBu/yAfMN5qQXYdFMmZy4yGV6C8vamwgp+v WXqQAhYIRLtg1BUbvVW1gjCv2bhBkqd4UEsaQbCTJN+fvbm42oy02Yxt/+YWzsremchSxQ sbMdxKaLi652e2IXNMiHqH0PzZX5Lo4= Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by dfw.source.kernel.org (Postfix) with ESMTPS id 1C4EA645C6 for ; Sat, 15 Apr 2023 00:18:17 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 5AFF5C433EF; Sat, 15 Apr 2023 00:18:16 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1681517896; bh=gwoDKthJAF1WHfbGuiCRuLpxNhrgjIi9oMkJ9fM63b0=; h=Subject:From:To:Date:In-Reply-To:References:From; b=q30o4mYFhbelsQ8SGE1YZKn7WuVdtBSkF/hM8jmtBXkBFL3iTHEyl/yOTRJojvgFL HtRjb1M2zuyVP9HdYzisBRXDr7Nudgn6kl8Sfkd6Wk5RiNo0Awfxy9tR01XCJdY+vN ztCNBwS4uIFBTzJzqXnDdlzU7Z+Pbk+zEUIZH+dmsfxnAMXQpeOg8MMG+e9ilf85Lq MK0S+fv153+w9uV3dASWZ/ekqK5L93DeDpcoPINWbGQmkp5OkG2brxO0k+oH/22SMe +XlBeo3arby3UnHwREkIDVlkbDJfJ+dOYot8uc+M3lMHXMV6OqcBkP5MVFIGHjG+1V EAIAoVm5G/SeQ== Subject: [PATCH v1 4/4] SUNRPC: Be even lazier about releasing pages From: Chuck Lever To: linux-nfs@vger.kernel.org, linux-mm@kvack.org Date: Fri, 14 Apr 2023 20:18:15 -0400 Message-ID: <168151789543.1588.6591139655130358318.stgit@klimt.1015granger.net> In-Reply-To: <168151777579.1588.7882383278745556830.stgit@klimt.1015granger.net> References: <168151777579.1588.7882383278745556830.stgit@klimt.1015granger.net> User-Agent: StGit/1.5 MIME-Version: 1.0 X-Rspamd-Queue-Id: 02FBC4001C X-Stat-Signature: bktedx7psyjd7mrztcxrotqxiawpb8kn X-Rspam-User: X-Rspamd-Server: rspam08 X-HE-Tag: 1681517897-761596 X-HE-Meta: U2FsdGVkX18UxK/oC/tFIlMgvPuz0I7WF6vFSHuF6pJ6tET6/L/xEro9jSGc88fmxPQeTCVzOwgH/OgPsy0GNtBt9TxZXN96trzGXpM27oOid/89lSc5ohbNtVGE5SGGTm5Uvt1O1hyiwPVQ7LoZGeTEkerA8EfxRfEkgJKZ9Q6P3DlriWQBW/J1Kv3nO9ZCcf+uqg1FRosJAM3LytA+UtyM1aIDFnKiVZH/9Daq6vqniPZ7UdKqjYKm30MbYGiVO2x32Ut9G7ivb2ap6WxlAShFrOhE1/naBVTavgnVn18g6/6/4fdX5YBSuErrnnclozbE6O8fiAnTm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.org Precedence: bulk X-Loop: owner-majordomo@kvack.org List-ID: From: Chuck Lever A single RPC transaction that touches only a couple of pages means rq_pvec will not be even close to full in svc_xpt_release(). This is a common case. Instead, just leave the pages in rq_pvec until it is completely full. This improves the efficiency of the batch release mechanism on workloads that involve small RPC messages. The rq_pvec is also fully emptied just before thread exit. Signed-off-by: Chuck Lever --- net/sunrpc/svc.c | 3 +++ net/sunrpc/svc_xprt.c | 3 --- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/net/sunrpc/svc.c b/net/sunrpc/svc.c index b982f802f2a0..26367cf4c17a 100644 --- a/net/sunrpc/svc.c +++ b/net/sunrpc/svc.c @@ -649,6 +649,8 @@ svc_rqst_alloc(struct svc_serv *serv, struct svc_pool *pool, int node) if (!rqstp) return rqstp; + pagevec_init(&rqstp->rq_pvec); + __set_bit(RQ_BUSY, &rqstp->rq_flags); rqstp->rq_server = serv; rqstp->rq_pool = pool; @@ -894,6 +896,7 @@ void svc_rqst_release_pages(struct svc_rqst *rqstp) void svc_rqst_free(struct svc_rqst *rqstp) { + pagevec_release(&rqstp->rq_pvec); svc_release_buffer(rqstp); if (rqstp->rq_scratch_page) put_page(rqstp->rq_scratch_page); diff --git a/net/sunrpc/svc_xprt.c b/net/sunrpc/svc_xprt.c index 533e08c4f319..e3952b690f54 100644 --- a/net/sunrpc/svc_xprt.c +++ b/net/sunrpc/svc_xprt.c @@ -541,7 +541,6 @@ static void svc_xprt_release(struct svc_rqst *rqstp) kfree(rqstp->rq_deferred); rqstp->rq_deferred = NULL; - pagevec_release(&rqstp->rq_pvec); svc_rqst_release_pages(rqstp); rqstp->rq_res.page_len = 0; rqstp->rq_res.page_base = 0; @@ -667,8 +666,6 @@ static int svc_alloc_arg(struct svc_rqst *rqstp) struct xdr_buf *arg = &rqstp->rq_arg; unsigned long pages, filled, ret; - pagevec_init(&rqstp->rq_pvec); - pages = (serv->sv_max_mesg + 2 * PAGE_SIZE) >> PAGE_SHIFT; if (pages > RPCSVC_MAXPAGES) { pr_warn_once("svc: warning: pages=%lu > RPCSVC_MAXPAGES=%lu\n",