From patchwork Tue Jul 4 00:08:15 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Chuck Lever X-Patchwork-Id: 13300551 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 vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 7DC0CEB64DD for ; Tue, 4 Jul 2023 00:08:20 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S230334AbjGDAIT (ORCPT ); Mon, 3 Jul 2023 20:08:19 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:56366 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229504AbjGDAIS (ORCPT ); Mon, 3 Jul 2023 20:08:18 -0400 Received: from dfw.source.kernel.org (dfw.source.kernel.org [139.178.84.217]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 0AAC618C for ; Mon, 3 Jul 2023 17:08:18 -0700 (PDT) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (2048 bits)) (No client certificate requested) by dfw.source.kernel.org (Postfix) with ESMTPS id 9A2186108B for ; Tue, 4 Jul 2023 00:08:17 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 92349C433CA; Tue, 4 Jul 2023 00:08:16 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1688429297; bh=zm+oq/ewIClG2atqKpuw+/NWExTCCv7xUTwq6hZ6ZMM=; h=Subject:From:To:Cc:Date:In-Reply-To:References:From; b=OErcOVWqOqiwM6WW/MKxqPi5kn5bGcorbWnQFNJpfWiUK+W6k93zYkExkq3d48OJS esxmU9Y3B3NhKttmJv1K54+JzMKZOgsS4QGfqW+Q14qcyfxLOH2ou6GwSOM2dkLQRn VHLfi83zC/mLcwzp3T/u3qu4V7/Xtes7mPg44VeDAkSoK44P2eEJ4xI/AbCJ/DOXsY JAYUPyiQkO198HrYuXn71FeG6HMfq3yjcK4t1y/b5cQzzMHWxQ1GuPgawChxx8My/z YtM60+1JIs7b1XW3TvB0xwhm2awtMR2A9Gm2smfmx4blQijEuqNciaUfxC7uNhWO/u GIkaMFaxjKNKw== Subject: [PATCH v2 7/9] SUNRPC: Don't disable BH's when taking sp_lock From: Chuck Lever To: linux-nfs@vger.kernel.org Cc: Chuck Lever , lorenzo@kernel.org, neilb@suse.de, jlayton@redhat.com, david@fromorbit.com Date: Mon, 03 Jul 2023 20:08:15 -0400 Message-ID: <168842929557.139194.4420161035549339648.stgit@manet.1015granger.net> In-Reply-To: <168842897573.139194.15893960758088950748.stgit@manet.1015granger.net> References: <168842897573.139194.15893960758088950748.stgit@manet.1015granger.net> User-Agent: StGit/1.5 MIME-Version: 1.0 Precedence: bulk List-ID: X-Mailing-List: linux-nfs@vger.kernel.org From: Chuck Lever Consumers of sp_lock now all run in process context. We can avoid the overhead of disabling bottom halves when taking this lock. Signed-off-by: Chuck Lever --- net/sunrpc/svc_xprt.c | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) diff --git a/net/sunrpc/svc_xprt.c b/net/sunrpc/svc_xprt.c index ecbccf0d89b9..8ced7591ce07 100644 --- a/net/sunrpc/svc_xprt.c +++ b/net/sunrpc/svc_xprt.c @@ -472,9 +472,9 @@ void svc_xprt_enqueue(struct svc_xprt *xprt) pool = svc_pool_for_cpu(xprt->xpt_server); percpu_counter_inc(&pool->sp_sockets_queued); - spin_lock_bh(&pool->sp_lock); + spin_lock(&pool->sp_lock); list_add_tail(&xprt->xpt_ready, &pool->sp_sockets); - spin_unlock_bh(&pool->sp_lock); + spin_unlock(&pool->sp_lock); rqstp = svc_pool_wake_idle_thread(xprt->xpt_server, pool); if (!rqstp) { @@ -496,14 +496,14 @@ static struct svc_xprt *svc_xprt_dequeue(struct svc_pool *pool) if (list_empty(&pool->sp_sockets)) goto out; - spin_lock_bh(&pool->sp_lock); + spin_lock(&pool->sp_lock); if (likely(!list_empty(&pool->sp_sockets))) { xprt = list_first_entry(&pool->sp_sockets, struct svc_xprt, xpt_ready); list_del_init(&xprt->xpt_ready); svc_xprt_get(xprt); } - spin_unlock_bh(&pool->sp_lock); + spin_unlock(&pool->sp_lock); out: return xprt; } @@ -1116,15 +1116,15 @@ static struct svc_xprt *svc_dequeue_net(struct svc_serv *serv, struct net *net) for (i = 0; i < serv->sv_nrpools; i++) { pool = &serv->sv_pools[i]; - spin_lock_bh(&pool->sp_lock); + spin_lock(&pool->sp_lock); list_for_each_entry_safe(xprt, tmp, &pool->sp_sockets, xpt_ready) { if (xprt->xpt_net != net) continue; list_del_init(&xprt->xpt_ready); - spin_unlock_bh(&pool->sp_lock); + spin_unlock(&pool->sp_lock); return xprt; } - spin_unlock_bh(&pool->sp_lock); + spin_unlock(&pool->sp_lock); } return NULL; }