Received: by 2002:a05:6358:489b:b0:bb:da1:e618 with SMTP id x27csp5782763rwn; Mon, 12 Sep 2022 14:24:05 -0700 (PDT) X-Google-Smtp-Source: AA6agR50LHVjMX1naC56vAKN7UxUpxa4q+sN0iitv4Icw3BK1ZawTz63NDbFqwfJbR7kZTAdyGug X-Received: by 2002:a17:902:d4c9:b0:178:1e39:31f7 with SMTP id o9-20020a170902d4c900b001781e3931f7mr12444028plg.142.1663017845639; Mon, 12 Sep 2022 14:24:05 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1663017845; cv=none; d=google.com; s=arc-20160816; b=d2OJRJ32g9D0CGQGWOJOMVgeZKMhxJ2nsEzS8/GbhGvqgnJ6mmZxdOjyIxxUR3rmjp JlBRYTWOSCY7SuPw4fRwRH6/PeE+zDgoil7cgTJMowYyNVxrQdvobvCMF4MPlsHmwFQD MdLX0qNNAIbrPR8o2s+qQCgd2ZBCmLxij8TYfnYXueD+RxLPcLorov8qlM07WvFByqTU HgSje7XG7h5csGSdWQJE3aX3XqXS8SEhNvZm4ywXp/B7D6EXABA2K5ILMq57Bi7h/z1T PRYwaVL4ouLPvbjQw8UthCK+GgUnuVXFvPifMWDv/4pyHXMifk0lqpCIBehhMb5xArwf qtLQ== 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:to:from:subject; bh=GHvwfVTowNrvRWQDqjlue+XLtwl82e1g3qb8GtNL7Ic=; b=GfCCdprwTQXnLQOZ+mlmMYc5sygwYf1Kc96QQ62xiav5gyepM/pO3xFzCM+dh4jmEM IJod2wYnwsh8StXl7MF2RLmvFkkfTpgtUYxwduq8nyiEYsKpaEduzrcVvb9ZpYEIyu3U 097xorRSHvvP9RKMlMJaM4TyQ2CwjAnoIafiaT3WrnhErwviMWohtysKHjcg6EoB86vc RqsoIfCCKImZXgu4nP+UWyoxfG+6QlXM94rXiAf4suLc1eQZSeznNSyJlOqVA00yN3mF BiA9uNI3wsgAk8T5v5ddo/CznHCvjdj0ceSquEbQcdDfV11gb6VZtkqYHNQnfuwyYGiZ U+Nw== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: domain of linux-nfs-owner@vger.kernel.org designates 2620:137:e000::1:20 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 out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id x69-20020a638648000000b0041c227d3793si10863226pgd.732.2022.09.12.14.23.52; Mon, 12 Sep 2022 14:24:05 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-nfs-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; spf=pass (google.com: domain of linux-nfs-owner@vger.kernel.org designates 2620:137:e000::1:20 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 S229700AbiILVWi (ORCPT + 99 others); Mon, 12 Sep 2022 17:22:38 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:51990 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229724AbiILVWh (ORCPT ); Mon, 12 Sep 2022 17:22:37 -0400 Received: from dfw.source.kernel.org (dfw.source.kernel.org [139.178.84.217]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 6B83A4B0E7 for ; Mon, 12 Sep 2022 14:22:34 -0700 (PDT) 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 561846124A for ; Mon, 12 Sep 2022 21:22:34 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id BB65EC433D7 for ; Mon, 12 Sep 2022 21:22:33 +0000 (UTC) Subject: [PATCH v1 01/12] SUNRPC: Optimize svc_process() From: Chuck Lever To: linux-nfs@vger.kernel.org Date: Mon, 12 Sep 2022 17:22:33 -0400 Message-ID: <166301775296.89884.6944917394566836389.stgit@oracle-102.nfsv4.dev> In-Reply-To: <166301759113.89884.7985359396842428444.stgit@oracle-102.nfsv4.dev> References: <166301759113.89884.7985359396842428444.stgit@oracle-102.nfsv4.dev> User-Agent: StGit/1.5 MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: 7bit X-Spam-Status: No, score=-6.7 required=5.0 tests=BAYES_00, HEADER_FROM_DIFFERENT_DOMAINS,RCVD_IN_DNSWL_HI,SPF_HELO_NONE,SPF_PASS, T_SCC_BODY_TEXT_LINE autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-nfs@vger.kernel.org Move exception handling code out of the hot path, and avoid the need for a bswap of a non-constant. Signed-off-by: Chuck Lever --- net/sunrpc/svc.c | 24 +++++++++++------------- 1 file changed, 11 insertions(+), 13 deletions(-) diff --git a/net/sunrpc/svc.c b/net/sunrpc/svc.c index 7c9a0d0b1230..4268145490a4 100644 --- a/net/sunrpc/svc.c +++ b/net/sunrpc/svc.c @@ -1434,8 +1434,7 @@ svc_process(struct svc_rqst *rqstp) { struct kvec *argv = &rqstp->rq_arg.head[0]; struct kvec *resv = &rqstp->rq_res.head[0]; - struct svc_serv *serv = rqstp->rq_server; - u32 dir; + __be32 dir; #if IS_ENABLED(CONFIG_FAIL_SUNRPC) if (!fail_sunrpc.ignore_server_disconnect && @@ -1450,7 +1449,7 @@ svc_process(struct svc_rqst *rqstp) rqstp->rq_next_page = &rqstp->rq_respages[1]; resv->iov_base = page_address(rqstp->rq_respages[0]); resv->iov_len = 0; - rqstp->rq_res.pages = rqstp->rq_respages + 1; + rqstp->rq_res.pages = rqstp->rq_next_page; rqstp->rq_res.len = 0; rqstp->rq_res.page_base = 0; rqstp->rq_res.page_len = 0; @@ -1458,18 +1457,17 @@ svc_process(struct svc_rqst *rqstp) rqstp->rq_res.tail[0].iov_base = NULL; rqstp->rq_res.tail[0].iov_len = 0; - dir = svc_getnl(argv); - if (dir != 0) { - /* direction != CALL */ - svc_printk(rqstp, "bad direction %d, dropping request\n", dir); - serv->sv_stats->rpcbadfmt++; + dir = svc_getu32(argv); + if (dir != rpc_call) + goto out_baddir; + if (!svc_process_common(rqstp, argv, resv)) goto out_drop; - } - - /* Returns 1 for send, 0 for drop */ - if (likely(svc_process_common(rqstp, argv, resv))) - return svc_send(rqstp); + return svc_send(rqstp); +out_baddir: + svc_printk(rqstp, "bad direction 0x%08x, dropping request\n", + be32_to_cpu(dir)); + rqstp->rq_server->sv_stats->rpcbadfmt++; out_drop: svc_drop(rqstp); return 0;