From: Kemeng Shi <shikemeng@huaweicloud.com>
To: Bernd Schubert <bernd.schubert@fastmail.fm>,
miklos@szeredi.hu, linux-fsdevel@vger.kernel.org,
linux-kernel@vger.kernel.org
Subject: Re: [PATCH] fuse: remove unneeded lock which protecting update of congestion_threshold
Date: Tue, 19 Sep 2023 14:11:59 +0800 [thread overview]
Message-ID: <177d891e-9258-68bb-72aa-4d4126403b7e@huaweicloud.com> (raw)
In-Reply-To: <9a5d4c82-1ab3-e96d-98bb-369acc8404d1@fastmail.fm>
on 9/16/2023 7:06 PM, Bernd Schubert wrote:
>
>
> 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 <shikemeng@huaweicloud.com>
>> ---
>> 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.
Sure, WRITE_ONCE looks better. I wonder if we should use READ_ONCE from reader.
Would like to get any advice. Thanks!
>
>
> Thanks,
> Bernd
>
next prev parent reply other threads:[~2023-09-19 6:12 UTC|newest]
Thread overview: 6+ messages / expand[flat|nested] mbox.gz Atom feed top
2023-09-14 15:45 Kemeng Shi
2023-09-16 11:06 ` Bernd Schubert
2023-09-19 6:11 ` Kemeng Shi [this message]
2023-09-19 13:12 ` Bernd Schubert
2023-09-27 3:04 ` Kemeng Shi
2023-10-06 17:15 ` Bernd Schubert
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=177d891e-9258-68bb-72aa-4d4126403b7e@huaweicloud.com \
--to=shikemeng@huaweicloud.com \
--cc=bernd.schubert@fastmail.fm \
--cc=linux-fsdevel@vger.kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=miklos@szeredi.hu \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox
all inboxes | Powered by JetHome®