Received: by 2002:a05:7412:40d:b0:e2:908c:2ebd with SMTP id 13csp518104rdf; Tue, 21 Nov 2023 08:41:04 -0800 (PST) X-Google-Smtp-Source: AGHT+IGzzUMduLvoDzkObyHfn7ZwWwda+rygYdjB4tU/4CB9vtgewDCWWlO1VCdo20KCuHe0PML/ X-Received: by 2002:a05:6a21:1444:b0:187:9f36:c30a with SMTP id oc4-20020a056a21144400b001879f36c30amr7666987pzb.39.1700584864192; Tue, 21 Nov 2023 08:41:04 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1700584864; cv=none; d=google.com; s=arc-20160816; b=wqglEWWjXScmtOC7/kYZ+JRotgwehJNZNp3u+TWGrxytDNii33xobvSNOnnhROEDoe bRW+Qp3G7RS3ve9GoX6AhZgMM4mVM4x18MlM86vFBo1s/i5QdHps7AIfKu1bL0gvDGJM k+Gh045zxR78xNyr9yOkG53Z9rNBB+Cwjl8K5PwSR+hzwJpGnYu/ZPA+UjHWdmOMPgwe 07o/gfYcBXW2bSPvw43ERnMFw3781o0OFbvV3pHAicVKho8n6ERHTT0gcNrCdjRhZ8cK JTfR3TdK3YH58Jvj9NXD6RzR1uj4OM6iNUGjiAfy4WttpDHtWrMmHeP2yqrYYCU0ZuDW CJJA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=content-transfer-encoding:mime-version:list-unsubscribe :list-subscribe:list-id:precedence:user-agent:references:in-reply-to :message-id:date:cc:to:from:subject:dkim-signature; bh=j8cDmyuwIcLkHDoWcG643H+rFlbe++NWu7PWpRMWnuk=; fh=ckZOnuavOce67CxFsxbWAkDFDgnVrD8nvvkVrKxmLnw=; b=vo9mvurpKqm3KRS4CunGvLg0TWauo3kU7NMQ2Tv3nDMEWSUQNnFrr+zNnSHpeBDJQw I/I8GTlEwtJQLxnbfN1LCuC+0FIn/UiROO9wu7GCYKcaHBKjT0YfBlrpXKSKdTYiUCc9 mUEsLCBArKIJwgilewIcU1NybMDyMhPs3STZ3LtBOqXoMxN7uQCn/2OhCjmXaMlUOzwp /JtENr++QPOXzc6mC+zWGEB32lU2cG76ZXEHqjsx9a2CbuR6m6bdYxie/DWb6ZrHfw9V 3nHXc9+kkl3LICFImyiollT473PdutZ366WfuCR7jhXhtQiq9e3nQhtuP+SRKqTHZObZ QpqA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b=KyMP5EBu; spf=pass (google.com: domain of linux-nfs+bounces-16-linux.lists.archive=gmail.com@vger.kernel.org designates 147.75.48.161 as permitted sender) smtp.mailfrom="linux-nfs+bounces-16-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Return-Path: Received: from sy.mirrors.kernel.org (sy.mirrors.kernel.org. [147.75.48.161]) by mx.google.com with ESMTPS id e6-20020a056a001a8600b006bf531dd685si11134410pfv.64.2023.11.21.08.41.03 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 21 Nov 2023 08:41:04 -0800 (PST) Received-SPF: pass (google.com: domain of linux-nfs+bounces-16-linux.lists.archive=gmail.com@vger.kernel.org designates 147.75.48.161 as permitted sender) client-ip=147.75.48.161; Authentication-Results: mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b=KyMP5EBu; spf=pass (google.com: domain of linux-nfs+bounces-16-linux.lists.archive=gmail.com@vger.kernel.org designates 147.75.48.161 as permitted sender) smtp.mailfrom="linux-nfs+bounces-16-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Received: from smtp.subspace.kernel.org (wormhole.subspace.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by sy.mirrors.kernel.org (Postfix) with ESMTPS id 2136CB210EB for ; Tue, 21 Nov 2023 16:40:44 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id 2F010524A5; Tue, 21 Nov 2023 16:40:42 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b="KyMP5EBu" X-Original-To: linux-nfs@vger.kernel.org Received: from smtp.kernel.org (aws-us-west-2-korg-mail-1.web.codeaurora.org [10.30.226.201]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id B81A654F84; Tue, 21 Nov 2023 16:40:41 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id B6B20C433C7; Tue, 21 Nov 2023 16:40:40 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1700584841; bh=fMAjswW6FaD33f8jFr1R2Mrswv8swYTGjRxSwkpVq7g=; h=Subject:From:To:Cc:Date:In-Reply-To:References:From; b=KyMP5EBuffCuu0JyyGDlPKop1TTi8XWos6UCJkJ+1YpeK7dav37WvbDdYYqnpPao/ EnvW/WwnT8+wPpKL1Qtz7nv0uwsJWb4BxtJB7eRdft+o1BysvfPeISSi1rmHoBpn7N bMYMkCDJ/ZOUDsARYcmGvjncyTBX0KsmuusrHbQg+U5A58IVN+NvixfviZJEP26H48 dEOCEm/mZrt0+/tfxaewRIvK/aAU/6L26b1A0ix6pLcdpoczKNEKja9NQaMfuxHsdW ltQwVsOYreo6+o7FfHNcFFIfRDwA/DhOrp7H6AHQZvJ2akMG/owTmJfqak3mXfUv6o L9lZI1HtLqFOA== Subject: [PATCH v2 5/6] svcrdma: Add an async version of svc_rdma_write_info_free() From: Chuck Lever To: linux-nfs@vger.kernel.org, linux-rdma@vger.kernel.org Cc: Chuck Lever , tom@talpey.com Date: Tue, 21 Nov 2023 11:40:39 -0500 Message-ID: <170058483977.4504.7623142897967608695.stgit@bazille.1015granger.net> In-Reply-To: <170058462629.4504.17663192195815644972.stgit@bazille.1015granger.net> References: <170058462629.4504.17663192195815644972.stgit@bazille.1015granger.net> User-Agent: StGit/1.5 Precedence: bulk X-Mailing-List: linux-nfs@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: 7bit From: Chuck Lever DMA unmapping can take quite some time, so it should not be handled in a single-threaded completion handler. Defer releasing write_info structs to the recently-added workqueue. With this patch, DMA unmapping can be handled in parallel, and it does not cause head-of-queue blocking of Write completions. Signed-off-by: Chuck Lever --- net/sunrpc/xprtrdma/svc_rdma_rw.c | 12 +++++++++++- 1 file changed, 11 insertions(+), 1 deletion(-) diff --git a/net/sunrpc/xprtrdma/svc_rdma_rw.c b/net/sunrpc/xprtrdma/svc_rdma_rw.c index e460e25a1d6d..de1ec3220aab 100644 --- a/net/sunrpc/xprtrdma/svc_rdma_rw.c +++ b/net/sunrpc/xprtrdma/svc_rdma_rw.c @@ -227,6 +227,7 @@ struct svc_rdma_write_info { unsigned int wi_next_off; struct svc_rdma_chunk_ctxt wi_cc; + struct work_struct wi_work; }; static struct svc_rdma_write_info * @@ -248,12 +249,21 @@ svc_rdma_write_info_alloc(struct svcxprt_rdma *rdma, return info; } -static void svc_rdma_write_info_free(struct svc_rdma_write_info *info) +static void svc_rdma_write_info_free_async(struct work_struct *work) { + struct svc_rdma_write_info *info; + + info = container_of(work, struct svc_rdma_write_info, wi_work); svc_rdma_cc_release(&info->wi_cc, DMA_TO_DEVICE); kfree(info); } +static void svc_rdma_write_info_free(struct svc_rdma_write_info *info) +{ + INIT_WORK(&info->wi_work, svc_rdma_write_info_free_async); + queue_work(svcrdma_wq, &info->wi_work); +} + /** * svc_rdma_write_done - Write chunk completion * @cq: controlling Completion Queue