From: Chengming Zhou <chengming.zhou@linux.dev>
To: Muchun Song <songmuchun@bytedance.com>, axboe@kernel.dk
Cc: josef@toxicpanda.com, oleg@redhat.com,
linux-block@vger.kernel.org, linux-kernel@vger.kernel.org,
muchun.song@linux.dev
Subject: Re: [PATCH] block: remove redundant explicit memory barrier from rq_qos waiter and waker
Date: Tue, 22 Oct 2024 15:53:08 +0800 [thread overview]
Message-ID: <c297cba9-5136-46b6-b2a4-5169a1a3f7cf@linux.dev> (raw)
In-Reply-To: <20241021085251.73353-1-songmuchun@bytedance.com>
On 2024/10/21 16:52, Muchun Song wrote:
> The memory barriers in list_del_init_careful() and list_empty_careful()
> in pairs already handle the proper ordering between data.got_token
> and data.wq.entry. So remove the redundant explicit barriers. And also
> change a "break" statement to "return" to avoid redundant calling of
> finish_wait().
>
> Signed-off-by: Muchun Song <songmuchun@bytedance.com>
Good catch! Just a small nit below, feel free to add:
Reviewed-by: Chengming Zhou <chengming.zhou@linux.dev>
> ---
> block/blk-rq-qos.c | 4 +---
> 1 file changed, 1 insertion(+), 3 deletions(-)
>
> diff --git a/block/blk-rq-qos.c b/block/blk-rq-qos.c
> index dc510f493ba57..9b0aa7dd6779f 100644
> --- a/block/blk-rq-qos.c
> +++ b/block/blk-rq-qos.c
> @@ -218,7 +218,6 @@ static int rq_qos_wake_function(struct wait_queue_entry *curr,
> return -1;
>
> data->got_token = true;
> - smp_wmb();
> wake_up_process(data->task);
> list_del_init_careful(&curr->entry);
> return 1;
> @@ -274,10 +273,9 @@ void rq_qos_wait(struct rq_wait *rqw, void *private_data,
> * which means we now have two. Put our local token
> * and wake anyone else potentially waiting for one.
> */
> - smp_rmb();
> if (data.got_token)
> cleanup_cb(rqw, private_data);
> - break;
> + return;
> }
Would it be better to move this acquire_inflight_cb() above out of
the do-while(1) since we rely on the waker to get inflight counter
for us?
Thanks.
> io_schedule();
> has_sleeper = true;
next prev parent reply other threads:[~2024-10-22 7:53 UTC|newest]
Thread overview: 7+ messages / expand[flat|nested] mbox.gz Atom feed top
2024-10-21 8:52 Muchun Song
2024-10-21 13:45 ` Jens Axboe
2024-10-22 6:31 ` Muchun Song
2024-10-22 19:59 ` Omar Sandoval
2024-10-22 7:53 ` Chengming Zhou [this message]
2024-10-22 8:02 ` Muchun Song
2024-10-22 22:25 ` Jens Axboe
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=c297cba9-5136-46b6-b2a4-5169a1a3f7cf@linux.dev \
--to=chengming.zhou@linux.dev \
--cc=axboe@kernel.dk \
--cc=josef@toxicpanda.com \
--cc=linux-block@vger.kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=muchun.song@linux.dev \
--cc=oleg@redhat.com \
--cc=songmuchun@bytedance.com \
/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®