[<prev] [next>] [day] [month] [year] [list]
Message-ID: <afe5b403-4e37-80fd-643d-79e0876a7047@linux.alibaba.com>
Date: Sat, 17 Sep 2022 17:10:29 +0800
From: Liu Song <liusong@...ux.alibaba.com>
To: Hillf Danton <hdanton@...a.com>
Cc: axboe@...nel.dk, linux-kernel@...r.kernel.org
Subject: Re: [PATCH] sbitmap: fix permanent io blocking caused by insufficient
wakeup times
On 2022/9/17 11:58, Hillf Danton wrote:
> On 17 Sep 2022 10:33:01 +0800 Liu Song <liusong@...ux.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;
> }
Powered by blists - more mailing lists