]> www.infradead.org Git - users/jedix/linux-maple.git/commit
block: refactor rq_qos_wait()
authorMuchun Song <songmuchun@bytedance.com>
Sat, 8 Feb 2025 09:04:16 +0000 (17:04 +0800)
committerJens Axboe <axboe@kernel.dk>
Tue, 11 Feb 2025 20:04:11 +0000 (13:04 -0700)
commita052bfa636bb763786b9dc13a301a59afb03787a
treeb89c2f78cebb73bb4e622ca94b8be693929e39f8
parent36d03cb3277e29beedb87b8efb1e4da02b26e0c0
block: refactor rq_qos_wait()

When rq_qos_wait() is first introduced, it is easy to understand. But
with some bug fixes applied, it is not easy for newcomers to understand
the whole logic under those fixes. In this patch, rq_qos_wait() is
refactored and more comments are added for better understanding. There
are 3 points for the improvement:

1) Use waitqueue_active() instead of wq_has_sleeper() to eliminate
   unnecessary memory barrier in wq_has_sleeper() which is supposed
   to be used in waker side. In this case, we do need the barrier.
   So use the cheaper one to locklessly test for waiters on the queue.

2) Remove acquire_inflight_cb() logic for the first waiter out of the
   while loop to make the code clear.

3) Add more comments to explain how to sync with different waiters and
   the waker.

Signed-off-by: Muchun Song <songmuchun@bytedance.com>
Reviewed-by: Yu Kuai <yukuai3@huawei.com>
Link: https://lore.kernel.org/r/20250208090416.38642-2-songmuchun@bytedance.com
Signed-off-by: Jens Axboe <axboe@kernel.dk>
block/blk-rq-qos.c