From patchwork Mon Sep 3 15:29:14 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Trond Myklebust X-Patchwork-Id: 10586061 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id E097013BB for ; Mon, 3 Sep 2018 15:30:06 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id D1C4F2962F for ; Mon, 3 Sep 2018 15:30:06 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id C64F829647; Mon, 3 Sep 2018 15:30:06 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-8.0 required=2.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,FREEMAIL_FROM,MAILING_LIST_MULTI,RCVD_IN_DNSWL_HI autolearn=ham version=3.3.1 Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id DF96D2962F for ; Mon, 3 Sep 2018 15:30:05 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1727079AbeICTuo (ORCPT ); Mon, 3 Sep 2018 15:50:44 -0400 Received: from mail-io0-f193.google.com ([209.85.223.193]:42906 "EHLO mail-io0-f193.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726314AbeICTuo (ORCPT ); Mon, 3 Sep 2018 15:50:44 -0400 Received: by mail-io0-f193.google.com with SMTP id n18-v6so676836ioa.9 for ; Mon, 03 Sep 2018 08:30:04 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=from:to:subject:date:message-id:in-reply-to:references:mime-version :content-transfer-encoding; bh=UOJwD56oNufUfXJ+job2ToRWij2s8o1OcBDrCLnBZro=; b=iLQQlWPIrUrDCGIbQ7kqmn14mrGs0lPLukSbk5zNX+yplr6PJO0WB3zkR9wBPKJN9k GEE2ZPrbBRIbpLBGrhcnmccfhuamPWmmIxZCCAkLyzyVGfao1LSodiYx63aykyPj/2UL uMZIJmlzleuHYfzd5umgZGZQ7D9dfYa/DOB8V+P/+Pzf3EcYh5x7yiIO87H6EDbwDj37 rTcsDk/PzMJY8sLXqbliWJuvS2qjBF97tVsvrWv2HM0+cMnTt6Flad/avro7wHhMezt7 U/0+vHDar6W7tUSduGNGRpLH2BR10HHHdyfwv/hjrM26eJVWqZt2U4MJyanCJX3KR6zr f4qw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=UOJwD56oNufUfXJ+job2ToRWij2s8o1OcBDrCLnBZro=; b=MUtASxB7G1607ezsz7OL0lMDcqrEuOMQqElwiZ44xuR5F5wqvRUdItJE9mVnAgLfhr g/5l2dS3jkx7ifHh9/Ah0wuAH+098EtzCfBZ5DzyMNhgJmsSzq/CfHPFyCgggg/1xC4F hkjiplaV5Pjz/k2w0kfVJsmNTZEFo2FRl/hBwBMpGgSWDef74DQoU3Jp7DmOS0edawLg dTJ9gAHRpEPTpmjie/nI3eQTR6wW+RjLk3QDum/4Xg0mBNgIuUPmgVg4RvQNJQdR5ShU 8un0na3OCyfeWC0Qn1BMOKOI3It1apKTJGGvLZPHzACCz02pUG7bKGNivpqC/XSriDDa G/3w== X-Gm-Message-State: APzg51AsFjsuAO6EtSqNI4HemAec/FsDoiuowmtHitRn659FdcTFYMZf C4LsdzNSpVOYCwrKkpnOqdy6chA= X-Google-Smtp-Source: ANB0VdZNk4OSNoPhpcW39WDdPyn9CxhAuQxRMSma1LKgVM3QP513/4yB77QcJESzFEYJzDjou23+Rg== X-Received: by 2002:a6b:7416:: with SMTP id s22-v6mr18373721iog.89.1535988603671; Mon, 03 Sep 2018 08:30:03 -0700 (PDT) Received: from leira.trondhjem.org.localdomain (c-68-40-195-73.hsd1.mi.comcast.net. [68.40.195.73]) by smtp.gmail.com with ESMTPSA id c25-v6sm7040027iob.30.2018.09.03.08.30.03 for (version=TLS1_2 cipher=ECDHE-RSA-CHACHA20-POLY1305 bits=256/256); Mon, 03 Sep 2018 08:30:03 -0700 (PDT) From: Trond Myklebust X-Google-Original-From: Trond Myklebust To: linux-nfs@vger.kernel.org Subject: [PATCH 05/27] SUNRPC: Avoid holding locks across the XDR encoding of the RPC message Date: Mon, 3 Sep 2018 11:29:14 -0400 Message-Id: <20180903152936.24325-6-trond.myklebust@hammerspace.com> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20180903152936.24325-5-trond.myklebust@hammerspace.com> References: <20180903152936.24325-1-trond.myklebust@hammerspace.com> <20180903152936.24325-2-trond.myklebust@hammerspace.com> <20180903152936.24325-3-trond.myklebust@hammerspace.com> <20180903152936.24325-4-trond.myklebust@hammerspace.com> <20180903152936.24325-5-trond.myklebust@hammerspace.com> MIME-Version: 1.0 Sender: linux-nfs-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-nfs@vger.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP Currently, we grab the socket bit lock before we allow the message to be XDR encoded. That significantly slows down the transmission rate, since we serialise on a potentially blocking operation. Signed-off-by: Trond Myklebust --- net/sunrpc/clnt.c | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/net/sunrpc/clnt.c b/net/sunrpc/clnt.c index e5ac35e803ad..66ec61347716 100644 --- a/net/sunrpc/clnt.c +++ b/net/sunrpc/clnt.c @@ -1949,9 +1949,6 @@ call_transmit(struct rpc_task *task) task->tk_action = call_status; if (task->tk_status < 0) return; - if (!xprt_prepare_transmit(task)) - return; - task->tk_action = call_transmit_status; /* Encode here so that rpcsec_gss can use correct sequence number. */ if (rpc_task_need_encode(task)) { rpc_xdr_encode(task); @@ -1965,8 +1962,11 @@ call_transmit(struct rpc_task *task) return; } } + if (!xprt_prepare_transmit(task)) + return; + task->tk_action = call_transmit_status; xprt_transmit(task); - if (task->tk_status < 0) + if (task->tk_status < 0) { return; if (is_retrans) task->tk_client->cl_stats->rpcretrans++;