From patchwork Tue Aug 23 17:53:09 2016 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Chuck Lever X-Patchwork-Id: 9296145 X-Patchwork-Delegate: Trond.Myklebust@netapp.com Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork.web.codeaurora.org (Postfix) with ESMTP id 46A76608A7 for ; Tue, 23 Aug 2016 18:06:20 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 3C41A28CDF for ; Tue, 23 Aug 2016 18:06:20 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 2085428CE5; Tue, 23 Aug 2016 18:06:20 +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=-6.8 required=2.0 tests=BAYES_00,DKIM_SIGNED, RCVD_IN_DNSWL_HI,T_DKIM_INVALID 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 23F5128CD8 for ; Tue, 23 Aug 2016 18:06:19 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1752154AbcHWSGC (ORCPT ); Tue, 23 Aug 2016 14:06:02 -0400 Received: from mail-it0-f68.google.com ([209.85.214.68]:36057 "EHLO mail-it0-f68.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1752444AbcHWSGA (ORCPT ); Tue, 23 Aug 2016 14:06:00 -0400 Received: by mail-it0-f68.google.com with SMTP id j124so8860859ith.3; Tue, 23 Aug 2016 11:06:00 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=sender:subject:from:to:date:message-id:in-reply-to:references :user-agent:mime-version:content-transfer-encoding; bh=jCW0JT+eS69NaeJ4Jo8fNtKxWQVtk3CHGgYmsiS2jIA=; b=JZ/A+L3MmlKTWx47FoSsW4n/3ZeSFrDYQ/xTqMvXeO+8h3DD8DchFfRn47WFuu78w3 A1rbTCOuPVamHz4Q8pmfRYSo859R6oxOxO+u6Zl1IwHu77voAFMpmZJKylfZmnc3lqts 73IFTIw529jdHcMr2dOH0eAPmOUC1/3Ba73RiqymT1iLIJrruaY53UczQ5lGdRiGiHKd qTl7Xh38oTdTt7/WeODt+bU60tCJxrEWEwmQw1DHyzkx/eH/iwRsgx2zwSG/aC/9P6Wy bROrlBOfIzdq9djRD6vI8ojZAR8qiB7oxpy/s2Llq9QQWCqPckFXTV3tUfavdU14+Fl3 9jLA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20130820; h=x-gm-message-state:sender:subject:from:to:date:message-id :in-reply-to:references:user-agent:mime-version :content-transfer-encoding; bh=jCW0JT+eS69NaeJ4Jo8fNtKxWQVtk3CHGgYmsiS2jIA=; b=WlTaViONUhLxn6oQPcBHSU/2WJ3nL7QIEi3sZ9FPbOx4OSEz94KkqKO5LrBbD5KCw1 5jms3CfpNOzS7OyJdjDc2IG075by2e2WQKm9lWu/zv9ewUMl+1bp2PMwtI9KRKbmPidw Z+jJ2S2wEncOevqq3+MrKy0lVjQGkyQJOG1vO007S9K4DGOpQsh8bEF9hc9EyDHsWKh7 EZpXJ2nNGHwE1BP2JbW4oIW5Na7GRsNCN1gE5ZJjNnFVzNsFsOjm7Lue32IJfgQgdYFK 2tsDfPjlIWgOspQj1nLyBYFMf3tnKNQiT+8Xc7h1wXAsEbubvqE+YuvvtU8/omyF/naC yU6g== X-Gm-Message-State: AEkoous/mNGf/5KeW1BSYzCmiasFKZyPUzRm6ehegEONqDusF/H3B5vTmqhdoX2KHY1Qbg== X-Received: by 10.36.254.201 with SMTP id w192mr29508471ith.4.1471974790749; Tue, 23 Aug 2016 10:53:10 -0700 (PDT) Received: from manet.1015granger.net ([2604:8800:100:81fc:ec4:7aff:fe6c:1dce]) by smtp.gmail.com with ESMTPSA id c38sm1767141ioj.19.2016.08.23.10.53.10 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Tue, 23 Aug 2016 10:53:10 -0700 (PDT) Subject: [PATCH v2 08/22] xprtrdma: Use smaller buffers for RPC-over-RDMA headers From: Chuck Lever To: linux-rdma@vger.kernel.org, linux-nfs@vger.kernel.org Date: Tue, 23 Aug 2016 13:53:09 -0400 Message-ID: <20160823175309.13038.64696.stgit@manet.1015granger.net> In-Reply-To: <20160823174402.13038.84561.stgit@manet.1015granger.net> References: <20160823174402.13038.84561.stgit@manet.1015granger.net> User-Agent: StGit/0.17.1-dirty 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 Commit 949317464bc2 ("xprtrdma: Limit number of RDMA segments in RPC-over-RDMA headers") capped the number of chunks that may appear in RPC-over-RDMA headers. The maximum header size can be estimated and fixed to avoid allocating buffer space that is never used. Signed-off-by: Chuck Lever --- net/sunrpc/xprtrdma/backchannel.c | 5 ++--- net/sunrpc/xprtrdma/transport.c | 2 +- net/sunrpc/xprtrdma/xprt_rdma.h | 5 ++++- 3 files changed, 7 insertions(+), 5 deletions(-) -- To unsubscribe from this list: send the line "unsubscribe linux-nfs" in the body of a message to majordomo@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html diff --git a/net/sunrpc/xprtrdma/backchannel.c b/net/sunrpc/xprtrdma/backchannel.c index c4904f8..60fc991 100644 --- a/net/sunrpc/xprtrdma/backchannel.c +++ b/net/sunrpc/xprtrdma/backchannel.c @@ -45,13 +45,12 @@ static int rpcrdma_bc_setup_rqst(struct rpcrdma_xprt *r_xprt, return PTR_ERR(req); req->rl_backchannel = true; - size = r_xprt->rx_data.inline_wsize; - rb = rpcrdma_alloc_regbuf(ia, size, GFP_KERNEL); + rb = rpcrdma_alloc_regbuf(ia, RPCRDMA_HDRBUF_SIZE, GFP_KERNEL); if (IS_ERR(rb)) goto out_fail; req->rl_rdmabuf = rb; - size += r_xprt->rx_data.inline_rsize; + size = r_xprt->rx_data.inline_rsize; rb = rpcrdma_alloc_regbuf(ia, size, GFP_KERNEL); if (IS_ERR(rb)) goto out_fail; diff --git a/net/sunrpc/xprtrdma/transport.c b/net/sunrpc/xprtrdma/transport.c index ecdc3ad..94dbfd3 100644 --- a/net/sunrpc/xprtrdma/transport.c +++ b/net/sunrpc/xprtrdma/transport.c @@ -484,7 +484,7 @@ static bool rpcrdma_get_rdmabuf(struct rpcrdma_xprt *r_xprt, struct rpcrdma_req *req, gfp_t flags) { - size_t size = r_xprt->rx_data.inline_wsize; + size_t size = RPCRDMA_HDRBUF_SIZE; struct rpcrdma_regbuf *rb; if (req->rl_rdmabuf) diff --git a/net/sunrpc/xprtrdma/xprt_rdma.h b/net/sunrpc/xprtrdma/xprt_rdma.h index 73f915f..c5137f0 100644 --- a/net/sunrpc/xprtrdma/xprt_rdma.h +++ b/net/sunrpc/xprtrdma/xprt_rdma.h @@ -160,7 +160,10 @@ rdmab_to_msg(struct rpcrdma_regbuf *rb) * The smallest inline threshold is 1024 bytes, ensuring that * at least 750 bytes are available for RPC messages. */ -#define RPCRDMA_MAX_HDR_SEGS (8) +enum { + RPCRDMA_MAX_HDR_SEGS = 8, + RPCRDMA_HDRBUF_SIZE = 256, +}; /* * struct rpcrdma_rep -- this structure encapsulates state required to recv