From patchwork Sat Apr 15 00:18:09 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Chuck Lever X-Patchwork-Id: 13212218 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 E2B37C77B76 for ; Sat, 15 Apr 2023 00:18:13 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id 830AC900006; Fri, 14 Apr 2023 20:18:13 -0400 (EDT) Received: by kanga.kvack.org (Postfix, from userid 40) id 7E0A0900002; Fri, 14 Apr 2023 20:18:13 -0400 (EDT) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id 6D02A900006; Fri, 14 Apr 2023 20:18:13 -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 60381900002 for ; Fri, 14 Apr 2023 20:18:13 -0400 (EDT) Received: from smtpin09.hostedemail.com (a10.router.float.18 [10.200.18.1]) by unirelay07.hostedemail.com (Postfix) with ESMTP id 3E7591604DB for ; Sat, 15 Apr 2023 00:18:13 +0000 (UTC) X-FDA: 80681713266.09.EB68145 Received: from dfw.source.kernel.org (dfw.source.kernel.org [139.178.84.217]) by imf05.hostedemail.com (Postfix) with ESMTP id 95CC5100008 for ; Sat, 15 Apr 2023 00:18:11 +0000 (UTC) Authentication-Results: imf05.hostedemail.com; dkim=pass header.d=kernel.org header.s=k20201202 header.b=AJ6awgWM; spf=pass (imf05.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=1681517891; 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=6zedfpfHHANWZW8FHkMixTgvI3kIP5zUCCi+zSANlF4=; b=vMwBE3u8EK5gWBiCas0MZTm+f9vW9mqlRDtkHoq5v5pmdXKGs9JkcwsJY5D0BGXjPLRM7S 86GZL5JzWyCE+NdLQ9oEm4eMDWzSnKT0uTIowAcdA+CGzU1Ue0CjKlDR0coj/tcja9P89L HxQe/1bA9rRmf65u2cqO0ixrz5FeZiQ= ARC-Authentication-Results: i=1; imf05.hostedemail.com; dkim=pass header.d=kernel.org header.s=k20201202 header.b=AJ6awgWM; spf=pass (imf05.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=1681517891; a=rsa-sha256; cv=none; b=WX+jzRT5eSINWOVyEoVJJU8xBGk8Cc+1bCukctq1FI16qPmAmNdpfWInz16mmeQSWB5Ffe itvJw8c2ePhMm4RzJuercTdLd+a8IIK3eMnKcGEN0AQMdA/aUCMbxIpWepkvD+5bAPbMZ8 Fwi0zlKPWR/AsNNDLOkuw9X4MKrLqgY= 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 C9E336450B for ; Sat, 15 Apr 2023 00:18:10 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 18C2EC433D2; Sat, 15 Apr 2023 00:18:10 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1681517890; bh=sTDSRZds3I5VoEZES7MzTU1WmuMqkd/9J180VGx4J2Y=; h=Subject:From:To:Date:In-Reply-To:References:From; b=AJ6awgWMSm3B3TfX59IIKRBUQuR6yBd3AA4wftjj7YJ+BvQMnJ0ebiRpshGEI4TnY RSUWdgYCu156/OJ1DjxyI11+KFeDIgxUPn2eC2s7bxqBHyla3bWJVJnkcRzWwy2zNc Ok0LfTV38XgpG/5m6JrR1SXv3emuat0CRFGdGkV2wxM/uIco8zBy+QIyuZBcN8HG2P 3InJk3jD8BqyeUP0+Qjo+z5hSOksJ86V+31kERTdQw8brsCHHmSccZKdyHJcP0m94i DxpFmg+fAMe3tn4H5Knu9gj6TXpJco+RSV1CSlD/V7aSnGckIt083n3wSk3uo4Mv3f P70g1Rjnh911w== Subject: [PATCH v1 3/4] SUNRPC: Convert svc_tcp_restore_pages() 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:09 -0400 Message-ID: <168151788914.1588.17896994938586012232.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-Server: rspam05 X-Rspamd-Queue-Id: 95CC5100008 X-Stat-Signature: riguubape13bj4uid4umujm7wikk7wx4 X-Rspam-User: X-HE-Tag: 1681517891-89363 X-HE-Meta: U2FsdGVkX19ZRhxTfm8DYSMS+KL2wD4pG27VCAGbhrgZ2QgMLNg6cZn5MqKQgcEP0cCrQb+cogHRM+NuRmSbuppfuCeUlMZm8fKKZSigdQqORXfFQrYte8kdsbE38D2H7aoFFPpmoLI3fOAQajE8N7lVDM6pz48wdTd2BxUkiMDu4omRoG3oLDeACH9LFqIjE9ix3L0QsK5mt4HIYq4SxRTEJxRyijDuJoA9jXAgPBOQCJCkbSGAdiXzOoIc1e3X0fk2LoRQNvPjyOJfVycetbBS7mehWfkVhz54OfFycwvHtGocqlcdgSW77gyztAHFGGOCIO2T8DF5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8uTJEMz2uVD9S6ZUjapg== X-Bogosity: Ham, tests=bogofilter, spamicity=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 portion of rq_pages to be released directly to release_pages() to reduce the number of times each server thread invokes a page allocator API. Signed-off-by: Chuck Lever --- net/sunrpc/svcsock.c | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/net/sunrpc/svcsock.c b/net/sunrpc/svcsock.c index 302a14dd7882..44f72b558a1c 100644 --- a/net/sunrpc/svcsock.c +++ b/net/sunrpc/svcsock.c @@ -812,12 +812,12 @@ static size_t svc_tcp_restore_pages(struct svc_sock *svsk, if (!len) return 0; npages = (len + PAGE_SIZE - 1) >> PAGE_SHIFT; - for (i = 0; i < npages; i++) { - if (rqstp->rq_pages[i] != NULL) - put_page(rqstp->rq_pages[i]); - BUG_ON(svsk->sk_pages[i] == NULL); - rqstp->rq_pages[i] = svsk->sk_pages[i]; - svsk->sk_pages[i] = NULL; + if (npages) { + release_pages(rqstp->rq_pages, npages); + for (i = 0; i < npages; i++) { + rqstp->rq_pages[i] = svsk->sk_pages[i]; + svsk->sk_pages[i] = NULL; + } } rqstp->rq_arg.head[0].iov_base = page_address(rqstp->rq_pages[0]); return len;