sbitmap: fix permanent io blocking caused by insufficient wakeup times
A message that is not in the archive (sent off-list or not yet received): [email protected]
Quoted 16 lines · Hillf Danton
Quoted 15 lines · On 17 Sep 2022 10:33:01 +0800 Liu Song <[email protected]> wrote:
(quoted diff) +5
-1@@ -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; }
Quoted 4 lines
Review static bool __sbq_wake_up(struct sbitmap_queue *sbq) · line 646
Quoted 1 line
(quoted diff) +0
-0return false;Hi Song,
See if advancing
wake_indexcan 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
Quoted 22 lines
Only for thoughts now.
Hillf
lib/sbitmap.c +1
-1@@ -611,6 +611,7 @@ static bool __sbq_wake_up(struct sbitmapif (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; }