]> git.baikalelectronics.ru Git - kernel.git/commit
wait: add wq_has_single_sleeper helper
authorJosef Bacik <josef@toxicpanda.com>
Tue, 16 Jul 2019 20:19:25 +0000 (16:19 -0400)
committerJens Axboe <axboe@kernel.dk>
Thu, 18 Jul 2019 16:20:13 +0000 (10:20 -0600)
commita1d040cdf0e9b1146a2ed231b2409361e4a44039
tree36ce9e58c5124c3d4308786a7e8daf3ea25ba1a2
parent8e375ad941de1aea61b8c2f13be35390cca8d796
wait: add wq_has_single_sleeper helper

rq-qos sits in the io path so we want to take locks as sparingly as
possible.  To accomplish this we try not to take the waitqueue head lock
unless we are sure we need to go to sleep, and we have an optimization
to make sure that we don't starve out existing waiters.  Since we check
if there are existing waiters locklessly we need to be able to update
our view of the waitqueue list after we've added ourselves to the
waitqueue.  Accomplish this by adding this helper to see if there is
more than just ourselves on the list.

Reviewed-by: Oleg Nesterov <oleg@redhat.com>
Signed-off-by: Josef Bacik <josef@toxicpanda.com>
Signed-off-by: Jens Axboe <axboe@kernel.dk>
include/linux/wait.h