[Devel] [PATCH RH7 10/12] rq-qos: don't reset has_sleepers on spurious wakeups

Pavel Tikhomirov ptikhomirov at virtuozzo.com
Thu Sep 29 14:30:10 MSK 2022


From: Josef Bacik <josef at toxicpanda.com>

If we raced with somebody else getting an inflight counter we could fail
to get an inflight counter with no sleepers on the list, and thus need
to go to sleep.  In this case has_sleepers should be true because we are
now relying on the waker to get our inflight counter for us.  And in the
case of spurious wakeups we'd still want this to be the case.  So set
has_sleepers to true if we went to sleep to make sure we're woken up the
proper way.

Reviewed-by: Oleg Nesterov <oleg at redhat.com>
Signed-off-by: Josef Bacik <josef at toxicpanda.com>
Signed-off-by: Jens Axboe <axboe at kernel.dk>

Changes when porting to vz7:
- original patch is patching block/blk-rq-qos.c:rq_qos_wait, but in vz7
  similar hunk is in block/blk-wbt.c:__wbt_wait

https://jira.sw.ru/browse/PSBM-141883
(cherry picked from commit 64e7ea875ef63b2801be7954cf7257d1bfccc266)
Signed-off-by: Pavel Tikhomirov <ptikhomirov at virtuozzo.com>
---
 block/blk-wbt.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/block/blk-wbt.c b/block/blk-wbt.c
index 5477c3ffe7a7..f3c0841f009a 100644
--- a/block/blk-wbt.c
+++ b/block/blk-wbt.c
@@ -598,7 +598,7 @@ static void __wbt_wait(struct rq_wb *rwb, enum wbt_flags wb_acct,
 		if (lock)
 			spin_lock_irq(lock);
 
-		has_sleeper = false;
+		has_sleeper = true;
 	} while (1);
 
 	finish_wait(&rqw->wait, &data.wq);
-- 
2.37.1



More information about the Devel mailing list