• David Jeffery's avatar
    sbitmap: fix batching wakeup · 10639737
    David Jeffery authored
    Current code supposes that it is enough to provide forward progress by
    just waking up one wait queue after one completion batch is done.
    
    Unfortunately this way isn't enough, cause waiter can be added to wait
    queue just after it is woken up.
    
    Follows one example(64 depth, wake_batch is 8)
    
    1) all 64 tags are active
    
    2) in each wait queue, there is only one single waiter
    
    3) each time one completion batch(8 completions) wakes up just one
       waiter in each wait queue, then immediately one new sleeper is added
       to this wait queue
    
    4) after 64 completions, 8 waiters are wakeup, and there are still 8
       waiters in each wait queue
    
    5) after another 8 active tags are completed, only one waiter can be
       wakeup, and the other 7 can't be waken up anymore.
    
    Turns out it isn't easy to fix this problem, so simply wakeup enough
    waiters for single batch.
    
    Cc: Kemeng Shi <shikemeng@huaweicloud.com>
    Cc: Chengming Zhou <zhouchengming@bytedance.com>
    Cc: Jan Kara <jack@suse.cz>
    Signed-off-by: default avatarDavid Jeffery <djeffery@redhat.com>
    Signed-off-by: default avatarMing Lei <ming.lei@redhat.com>
    Reviewed-by: default avatarGabriel Krisman Bertazi <krisman@suse.de>
    Reviewed-by: default avatarKeith Busch <kbusch@kernel.org>
    Link: https://lore.kernel.org/r/20230721095715.232728-1-ming.lei@redhat.comSigned-off-by: default avatarJens Axboe <axboe@kernel.dk>
    10639737
sbitmap.c 18.3 KB