From patchwork Sat Apr 15 00:18:02 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Chuck Lever X-Patchwork-Id: 13212217 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 AD85BC77B72 for ; Sat, 15 Apr 2023 00:18:07 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id 4FC40900005; Fri, 14 Apr 2023 20:18:07 -0400 (EDT) Received: by kanga.kvack.org (Postfix, from userid 40) id 4AC92900002; Fri, 14 Apr 2023 20:18:07 -0400 (EDT) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id 39B82900005; Fri, 14 Apr 2023 20:18:07 -0400 (EDT) X-Delivered-To: linux-mm@kvack.org Received: from relay.hostedemail.com (smtprelay0016.hostedemail.com [216.40.44.16]) by kanga.kvack.org (Postfix) with ESMTP id 29A63900002 for ; Fri, 14 Apr 2023 20:18:07 -0400 (EDT) Received: from smtpin03.hostedemail.com (a10.router.float.18 [10.200.18.1]) by unirelay05.hostedemail.com (Postfix) with ESMTP id EE72A404A2 for ; Sat, 15 Apr 2023 00:18:06 +0000 (UTC) X-FDA: 80681712972.03.117F62F Received: from dfw.source.kernel.org (dfw.source.kernel.org [139.178.84.217]) by imf10.hostedemail.com (Postfix) with ESMTP id 4E7FAC000A for ; Sat, 15 Apr 2023 00:18:05 +0000 (UTC) Authentication-Results: imf10.hostedemail.com; dkim=pass header.d=kernel.org header.s=k20201202 header.b=jYSxYefr; dmarc=pass (policy=none) header.from=kernel.org; spf=pass (imf10.hostedemail.com: domain of cel@kernel.org designates 139.178.84.217 as permitted sender) smtp.mailfrom=cel@kernel.org ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=hostedemail.com; s=arc-20220608; t=1681517885; 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=JpB3cSieB112O2mmYFTwIYmI2UkhPG4R6zR8Kdva88Y=; b=qSW0n6O5GIJ3AkRPsRQeL8ZYWsbDaAQjrw8JiBjZmfZygvZmnzzaxu/kpY0zSBSEuLxpKa RDkfUSCHRY1fpr3yJ4MTTI/NJfVDVqAjvfNJN5VTrkjUPm1RuvimdzqtrE1XBNnkBllTCx wcEt1UChsZQ+qNzkBOQjY1cQPYcmwIE= ARC-Authentication-Results: i=1; imf10.hostedemail.com; dkim=pass header.d=kernel.org header.s=k20201202 header.b=jYSxYefr; dmarc=pass (policy=none) header.from=kernel.org; spf=pass (imf10.hostedemail.com: domain of cel@kernel.org designates 139.178.84.217 as permitted sender) smtp.mailfrom=cel@kernel.org ARC-Seal: i=1; s=arc-20220608; d=hostedemail.com; t=1681517885; a=rsa-sha256; cv=none; b=HyEiAaxWvRE/tOZCTvfygYL6jUzNLQgoNREu0jxaM0eIg7tQhTwpIr08oW0qMFVH0EbDrh jKBnc4hZaVHuNzmHDGmz4wwM+jYNfuWERzwiNLzZ3LA2ZqqJR5YIoNPcCR/cRVcXirak/c y/IBluiF7asZPgHyI5Aetg5T6x2TvIE= 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 8483B616EB for ; Sat, 15 Apr 2023 00:18:04 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id C42B6C4339E; Sat, 15 Apr 2023 00:18:03 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1681517883; bh=RshTAt8N1txg6TF0maDP8tdDMDzPklBfrU/3+g+KeB8=; h=Subject:From:To:Date:In-Reply-To:References:From; b=jYSxYefrqfWu1kEKIKaipUqoEVNeS1w6Bew7vDGwis67wzwDtoDRpSup7gSR+lyhS 3o24x6abUfaF6oJH9e9zRDr/EucGPFxwfFnj6xwyJFgbNDDpCU5Y8S1hnbiVph2FDu k/iVHF6mKtq4B2eJdfBOZJomYCHedALLd0xFWnwyF9Z7VTN9YR9iy2DyMTSojnT7Gm mluQbC38LoNAC+bN8BgR53VzYVoDCbVzD2Yh23wE11YLdcK4pwjN0P/5sbT5OnFaaM a25PnOzBTCKvasRQP1BOitBiHL0JfByCoxIfCSfI14P4xAkpNJ2WU4QRySiSZWYrkr xhcHRqTR5aaDQ== Subject: [PATCH v1 2/4] SUNRPC: Convert svc_xprt_release() to the release_pages() API From: Chuck Lever To: linux-nfs@vger.kernel.org, linux-mm@kvack.org Date: Fri, 14 Apr 2023 20:18:02 -0400 Message-ID: <168151788284.1588.1198570306681230834.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-Rspam-User: X-Rspamd-Server: rspam02 X-Rspamd-Queue-Id: 4E7FAC000A X-Stat-Signature: fthdqfmccn3k5muim39ncffa6dftts1b X-HE-Tag: 1681517885-434609 X-HE-Meta: U2FsdGVkX1+PuRBnUnLuBWDAgyeSdBBDUmS10B2gMCtVwOBe/Q/fqHhTxGKJIdujxtHbTWQSsCtVr+RVOmFit54GET+AzG2/MMXiXZ+jueAWgvmnmNLDfGn+tMzwLXPL5bk99YLTw5wEqbX9HmJcO3wauuZldXt8GlnI1QQRLMII2CxebASySDyVth/V64H6ragfSWjjMcPfmRSu6oH2wERntUoN+sCdVrnT2GkJQmcANWsUfmrLbZqRyPTePlJ4ijfBmCkvua5wYLrU/0O9kmsghmD3/WmZOlncGTp/DdPMVGKl3E9eb5iwG3Py+SQtNn/Tedv+sxEEpsV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=0.000000, version=1.2.4 Sender: owner-linux-mm@kvack.org Precedence: bulk X-Loop: owner-majordomo@kvack.org List-ID: From: Chuck Lever Instead of invoking put_page() one-at-a-time, pass the "response" portion of rq_pages directly to release_pages() to reduce the number of times each nfsd thread invokes a page allocator API. Since svc_xprt_release() is not invoked while a client is waiting for an RPC Reply, this is not expected to directly impact mean request latencies on a lightly or moderately loaded server. However as workload intensity increases, I expect somewhat better scalability: the same number of server threads should be able to handle more work. Signed-off-by: Chuck Lever --- net/sunrpc/svc.c | 11 +++++------ 1 file changed, 5 insertions(+), 6 deletions(-) diff --git a/net/sunrpc/svc.c b/net/sunrpc/svc.c index 0fc70cc405b2..b982f802f2a0 100644 --- a/net/sunrpc/svc.c +++ b/net/sunrpc/svc.c @@ -878,13 +878,12 @@ EXPORT_SYMBOL_GPL(svc_rqst_replace_page); */ void svc_rqst_release_pages(struct svc_rqst *rqstp) { - while (rqstp->rq_next_page != rqstp->rq_respages) { - struct page **pp = --rqstp->rq_next_page; + int i, count = rqstp->rq_next_page - rqstp->rq_respages; - if (*pp) { - put_page(*pp); - *pp = NULL; - } + if (count) { + release_pages(rqstp->rq_respages, count); + for (i = 0; i < count; i++) + rqstp->rq_respages[i] = NULL; } }