From: Liu Song <liusong@linux.alibaba.com>
To: Hillf Danton <hdanton@sina.com>
Cc: axboe@kernel.dk, linux-kernel@vger.kernel.org
Subject: Re: [PATCH] sbitmap: fix permanent io blocking caused by insufficient wakeup times
Date: Sat, 17 Sep 2022 17:10:29 +0800 [thread overview]
Message-ID: <afe5b403-4e37-80fd-643d-79e0876a7047@linux.alibaba.com> (raw)
In-Reply-To: <20220917035831.735-1-hdanton@sina.com>
On 2022/9/17 11:58, Hillf Danton wrote:
> On 17 Sep 2022 10:33:01 +0800 Liu Song <liusong@linux.alibaba.com> wrote:
>> @@ -632,10 +633,14 @@ static bool __sbq_wake_up(struct sbitmap_queue *sbq)
>> if (ret == wait_cnt) {
>> sbq_index_atomic_inc(&sbq->wake_index);
>> wake_up_nr(&ws->wait, wake_batch);
>> - return false;
>> + if (!nr || *nr <= 0)
>> + return false;
>> }
>>
>> return true;
>> + } else if (nr && *nr) {
>> + (*nr)--;
>> + goto again;
>> }
>>
>> return false;
> Hi Song,
>
> See if advancing wake_index can survive your tests.
Hi
Thanks for your suggestion, this problem not only needs to switch a wait
queue, but also needs to consume "wait_cnt" correctly.
Thanks
>
> Only for thoughts now.
>
> Hillf
> --- a/lib/sbitmap.c
> +++ b/lib/sbitmap.c
> @@ -611,6 +611,7 @@ static bool __sbq_wake_up(struct sbitmap
> if (wait_cnt <= 0) {
> int ret;
>
> + sbq_index_atomic_inc(&sbq->wake_index);
> wake_batch = READ_ONCE(sbq->wake_batch);
>
> /*
> @@ -627,7 +628,6 @@ static bool __sbq_wake_up(struct sbitmap
> */
> ret = atomic_cmpxchg(&ws->wait_cnt, wait_cnt, wake_batch);
> if (ret == wait_cnt) {
> - sbq_index_atomic_inc(&sbq->wake_index);
> wake_up_nr(&ws->wait, wake_batch);
> return false;
> }
next parent reply other threads:[~2022-09-17 9:11 UTC|newest]
Thread overview: 4+ messages / expand[flat|nested] mbox.gz Atom feed top
[not found] <20220917035831.735-1-hdanton@sina.com>
2022-09-17 9:10 ` Liu Song [this message]
2022-09-17 2:33 [PATCH] sbitmap: fix permanent io blocking caused by insufficient wakeup times Liu Song
2022-09-17 10:20 ` Yu Kuai
2022-09-17 15:06 ` Liu Song
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=afe5b403-4e37-80fd-643d-79e0876a7047@linux.alibaba.com \
--to=liusong@linux.alibaba.com \
--cc=axboe@kernel.dk \
--cc=hdanton@sina.com \
--cc=linux-kernel@vger.kernel.org \
/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;
as well as URLs for NNTP newsgroup(s).