Received: by 2002:a05:7412:31a9:b0:e2:908c:2ebd with SMTP id et41csp5358468rdb; Sat, 16 Sep 2023 13:26:55 -0700 (PDT) X-Google-Smtp-Source: AGHT+IGiUmbQahhlzx19xBTDfAFT8HsFYoZboSYKYs9lA8QPq2sJ2SdnRXawMaXQXtEyhlEIodzZ X-Received: by 2002:a05:6a20:7f84:b0:154:e793:52b3 with SMTP id d4-20020a056a207f8400b00154e79352b3mr5618325pzj.0.1694896015563; Sat, 16 Sep 2023 13:26:55 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1694896015; cv=none; d=google.com; s=arc-20160816; b=kTf33E+ICoewNfVUhCVT97+CaijyDpQ350cGrOHHY+JPPtTkWqpTY8K8Q62BDUZttx HYRG/3wMdeETbNyTv+se4XrNFeN2p1z587a4N7NwTKEP2+R4zuajmeqFK9RlxFwoZX+R fXXp3ySPAx6+5NvhGf1hHuWxFt8ywQUDer5p6+lfa3hBGcdgvqNSsmZaMQF1HmK/YR20 oLTQtHUB1psBqzIEA6fFKHmlmaGtu8lZabp6w9tQj07KRZtrOlC6G00fP2RX9Xs8rC7X TtTzDEwIIDG/ZJGK1E0ECEj7AysTjpHkAAMISRlwd2HsB0Oz05/xNDrqegwgO5K39RCt hrdA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:in-reply-to:from :content-language:references:to:subject:user-agent:mime-version:date :message-id:feedback-id:dkim-signature:dkim-signature; bh=KNPnuJg5J06+4l2lKMSaca5bqznxaYuUEOM5vQKVna8=; fh=ZgF0wNHA4d22MtcnaQdOGuWx5csPHy/WlsWyL8NmZa8=; b=YanNDd3kME2n4ixK4qsCJdwa0mrkr6ry7vxYx7UgEj+2nRDk1LdsRN09IotV0tUMTv czas0Fl5Pye3Rof/ojpeAN7LqCdvWb7V8fqr8qk6c6fFROZqh/vSJxtTDeVWFtoSruMv xKhmWR/D4XIEOwTmHbMaWT3ZRgQLaRSnlEIKBkxllANcc3cmSyCD0m/97cDqr2PD1ni8 Bpqv8wiTqF3VxCPtc7Af4k4nr7mumMQzjN7ZT2uumIEz+RH/7ym+ccUndqwfZx23tbjV QXtZnRl6drrRGCIwrvAlyEHuwOqjKFKOmMa4ZB8q00m/W0r/C7QKCeHLZDvNHaCHt1ei plhA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@fastmail.fm header.s=fm2 header.b=mkCbZfvl; dkim=pass header.i=@messagingengine.com header.s=fm2 header.b=Qsr37rig; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::3:4 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=fastmail.fm Return-Path: Received: from howler.vger.email (howler.vger.email. [2620:137:e000::3:4]) by mx.google.com with ESMTPS id bs66-20020a632845000000b0057806be7290si4490519pgb.451.2023.09.16.13.26.54 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sat, 16 Sep 2023 13:26:55 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::3:4 as permitted sender) client-ip=2620:137:e000::3:4; Authentication-Results: mx.google.com; dkim=pass header.i=@fastmail.fm header.s=fm2 header.b=mkCbZfvl; dkim=pass header.i=@messagingengine.com header.s=fm2 header.b=Qsr37rig; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::3:4 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=fastmail.fm Received: from out1.vger.email (depot.vger.email [IPv6:2620:137:e000::3:0]) by howler.vger.email (Postfix) with ESMTP id 7B34E82289B5; Sat, 16 Sep 2023 04:10:57 -0700 (PDT) X-Virus-Status: Clean X-Virus-Scanned: clamav-milter 0.103.10 at howler.vger.email Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S238123AbjIPLHP (ORCPT + 99 others); Sat, 16 Sep 2023 07:07:15 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:41504 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S231482AbjIPLG5 (ORCPT ); Sat, 16 Sep 2023 07:06:57 -0400 Received: from wout3-smtp.messagingengine.com (wout3-smtp.messagingengine.com [64.147.123.19]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 0882D199; Sat, 16 Sep 2023 04:06:52 -0700 (PDT) Received: from compute5.internal (compute5.nyi.internal [10.202.2.45]) by mailout.west.internal (Postfix) with ESMTP id 6B8123200786; Sat, 16 Sep 2023 07:06:48 -0400 (EDT) Received: from mailfrontend2 ([10.202.2.163]) by compute5.internal (MEProxy); Sat, 16 Sep 2023 07:06:48 -0400 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=fastmail.fm; h= cc:content-transfer-encoding:content-type:content-type:date:date :from:from:in-reply-to:in-reply-to:message-id:mime-version :references:reply-to:sender:subject:subject:to:to; s=fm2; t= 1694862407; x=1694948807; bh=KNPnuJg5J06+4l2lKMSaca5bqznxaYuUEOM 5vQKVna8=; b=mkCbZfvl+H94RMDIQ4wQcwjOe8DLRu5U63SBcZ90yjii68T3RU7 WKa5cML2uU6Z9uX0K06C/rWAxSqapH3aDDOX2YpxXe6yGFNSDZJWV4e0Wg/aTNGE /FUtqfykOHzNi5bK7hsCdqSatHAKp0qTYm0Ed1C9MNoHqymcEaabbdVRVKTYIxmu aK6rmtIzwNHw92bsdzydM2qNLpsbrJoT9bvA/69Z3QRX6AzC2HqJ+pexnPITCknB I2qxuz7ZlWpSlksMKgB+kAN6YihCl/ZLJNchRhK2DattOTzIGfnaVK+EyhEZljgL kFcOt07ihc0iT3SXW1/sErao3UBdX48KruA== DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d= messagingengine.com; h=cc:content-transfer-encoding:content-type :content-type:date:date:feedback-id:feedback-id:from:from :in-reply-to:in-reply-to:message-id:mime-version:references :reply-to:sender:subject:subject:to:to:x-me-proxy:x-me-proxy :x-me-sender:x-me-sender:x-sasl-enc; s=fm2; t=1694862407; x= 1694948807; bh=KNPnuJg5J06+4l2lKMSaca5bqznxaYuUEOM5vQKVna8=; b=Q sr37rigZM4Y1cX+ddktp7mL/rAQP4yvCOcHW7NUQtSkCmyI1dLfTS9G1pdVue94h iXE/tzoFisZOb75PIdgpUTWI7rjZb3EVQuM79kw9KV4fpsB2bAqDYxeGTyKH+APy lo1+ikTkltDUAtSTYiqhAR8oxjEfIkyBixmWplYUsRegntBlCjtuep9wHemXK8hu TgYIX0azDrE0nC9EcRcxjoX7ErFCSeRy2/q3XTY2cmP/YkFNi9lbzBiB4Y5ZB6IP RCKCZ05FffLohvF+h1hP7TPnCNlSeA8/3K6BTRzlT+FincQw/sP3v8Yw0SFJRz7Y 2aOKM98P2x9swG8PErWKg== X-ME-Sender: X-ME-Received: X-ME-Proxy-Cause: gggruggvucftvghtrhhoucdtuddrgedviedrudejgedgfeeiucetufdoteggodetrfdotf fvucfrrhhofhhilhgvmecuhfgrshhtofgrihhlpdfqfgfvpdfurfetoffkrfgpnffqhgen uceurghilhhouhhtmecufedttdenucesvcftvggtihhpihgvnhhtshculddquddttddmne cujfgurhepkfffgggfuffvfhfhjggtgfesthejredttdefjeenucfhrhhomhepuegvrhhn ugcuufgthhhusggvrhhtuceosggvrhhnugdrshgthhhusggvrhhtsehfrghsthhmrghilh drfhhmqeenucggtffrrghtthgvrhhnpeegffdutdegiefgteelleeggeeuueduteefiedu vedvueefieejledvjeeuhfefgeenucevlhhushhtvghrufhiiigvpedtnecurfgrrhgrmh epmhgrihhlfhhrohhmpegsvghrnhgurdhstghhuhgsvghrthesfhgrshhtmhgrihhlrdhf mh X-ME-Proxy: Feedback-ID: id8a24192:Fastmail Received: by mail.messagingengine.com (Postfix) with ESMTPA; Sat, 16 Sep 2023 07:06:46 -0400 (EDT) Message-ID: <9a5d4c82-1ab3-e96d-98bb-369acc8404d1@fastmail.fm> Date: Sat, 16 Sep 2023 13:06:44 +0200 MIME-Version: 1.0 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:102.0) Gecko/20100101 Thunderbird/102.15.1 Subject: Re: [PATCH] fuse: remove unneeded lock which protecting update of congestion_threshold To: Kemeng Shi , miklos@szeredi.hu, linux-fsdevel@vger.kernel.org, linux-kernel@vger.kernel.org References: <20230914154553.71939-1-shikemeng@huaweicloud.com> Content-Language: en-US, de-DE From: Bernd Schubert In-Reply-To: <20230914154553.71939-1-shikemeng@huaweicloud.com> Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 7bit X-Spam-Status: No, score=-3.6 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,FREEMAIL_FROM,NICE_REPLY_A, RCVD_IN_DNSWL_BLOCKED,SPF_HELO_PASS,SPF_PASS,URIBL_BLOCKED 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-kernel@vger.kernel.org X-Greylist: Sender passed SPF test, not delayed by milter-greylist-4.6.4 (howler.vger.email [0.0.0.0]); Sat, 16 Sep 2023 04:10:57 -0700 (PDT) On 9/14/23 17:45, Kemeng Shi wrote: > Commit 670d21c6e17f6 ("fuse: remove reliance on bdi congestion") change how > congestion_threshold is used and lock in > fuse_conn_congestion_threshold_write is not needed anymore. > 1. Access to supe_block is removed along with removing of bdi congestion. > Then down_read(&fc->killsb) which protecting access to super_block is no > needed. > 2. Compare num_background and congestion_threshold without holding > bg_lock. Then there is no need to hold bg_lock to update > congestion_threshold. > > Signed-off-by: Kemeng Shi > --- > fs/fuse/control.c | 4 ---- > 1 file changed, 4 deletions(-) > > diff --git a/fs/fuse/control.c b/fs/fuse/control.c > index 247ef4f76761..c5d7bf80efed 100644 > --- a/fs/fuse/control.c > +++ b/fs/fuse/control.c > @@ -174,11 +174,7 @@ static ssize_t fuse_conn_congestion_threshold_write(struct file *file, > if (!fc) > goto out; > > - down_read(&fc->killsb); > - spin_lock(&fc->bg_lock); > fc->congestion_threshold = val; > - spin_unlock(&fc->bg_lock); > - up_read(&fc->killsb); > fuse_conn_put(fc); > out: > return ret; Yeah, I don't see readers holding any of these locks. I just wonder if it wouldn't be better to use WRITE_ONCE to ensure a single atomic operation to store the value. Thanks, Bernd