]> git.proxmox.com Git - mirror_ubuntu-bionic-kernel.git/commit
blk-mq: count the hctx as active before allocating tag
authorJianchao Wang <jianchao.w.wang@oracle.com>
Thu, 9 Aug 2018 14:34:17 +0000 (08:34 -0600)
committerJuerg Haefliger <juergh@canonical.com>
Wed, 24 Jul 2019 01:47:08 +0000 (19:47 -0600)
commit662e29d9ae67ab39138199514330695c7a5d4a4f
tree6ce4edec5a33ad84a2b3caf18bf7f00efcb95920
parentb34d81638347eecbcf13b1915371656d4930239d
blk-mq: count the hctx as active before allocating tag

BugLink: https://bugs.launchpad.net/bugs/1835972
[ Upstream commit d263ed9926823c462f99a7679e18f0c9e5b8550d ]

Currently, we count the hctx as active after allocate driver tag
successfully. If a previously inactive hctx try to get tag first
time, it may fails and need to wait. However, due to the stale tag
->active_queues, the other shared-tags users are still able to
occupy all driver tags while there is someone waiting for tag.
Consequently, even if the previously inactive hctx is waked up, it
still may not be able to get a tag and could be starved.

To fix it, we count the hctx as active before try to allocate driver
tag, then when it is waiting the tag, the other shared-tag users
will reserve budget for it.

Reviewed-by: Ming Lei <ming.lei@redhat.com>
Signed-off-by: Jianchao Wang <jianchao.w.wang@oracle.com>
Signed-off-by: Jens Axboe <axboe@kernel.dk>
Signed-off-by: Sasha Levin <alexander.levin@microsoft.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Signed-off-by: Kamal Mostafa <kamal@canonical.com>
Signed-off-by: Kleber Sacilotto de Souza <kleber.souza@canonical.com>
block/blk-mq-tag.c
block/blk-mq.c