summaryrefslogtreecommitdiffstats
path: root/block/bfq-wf2q.c
diff options
context:
space:
mode:
authorYu Kuai <yukuai3@huawei.com>2022-09-16 09:19:38 +0200
committerJens Axboe <axboe@kernel.dk>2022-11-01 14:09:44 +0100
commit60a6e10c537a7459dd53882186bd16fff257fb03 (patch)
treed25f98c14b4a0cc2cca985944c56dc263f908e36 /block/bfq-wf2q.c
parentblock, bfq: support to track if bfqq has pending requests (diff)
downloadlinux-60a6e10c537a7459dd53882186bd16fff257fb03.tar.xz
linux-60a6e10c537a7459dd53882186bd16fff257fb03.zip
block, bfq: record how many queues have pending requests
Prepare to refactor the counting of 'num_groups_with_pending_reqs'. Add a counter in bfq_group, update it while tracking if bfqq have pending requests and when bfq_bfqq_move() is called. Signed-off-by: Yu Kuai <yukuai3@huawei.com> Reviewed-by: Jan Kara <jack@suse.cz> Acked-by: Paolo Valente <paolo.valente@linaro.org> Link: https://lore.kernel.org/r/20220916071942.214222-3-yukuai1@huaweicloud.com Signed-off-by: Jens Axboe <axboe@kernel.dk>
Diffstat (limited to 'block/bfq-wf2q.c')
-rw-r--r--block/bfq-wf2q.c12
1 files changed, 10 insertions, 2 deletions
diff --git a/block/bfq-wf2q.c b/block/bfq-wf2q.c
index bd8f4ed84848..5549ccf09cd2 100644
--- a/block/bfq-wf2q.c
+++ b/block/bfq-wf2q.c
@@ -1650,16 +1650,24 @@ void bfq_add_bfqq_in_groups_with_pending_reqs(struct bfq_queue *bfqq)
{
struct bfq_entity *entity = &bfqq->entity;
- if (!entity->in_groups_with_pending_reqs)
+ if (!entity->in_groups_with_pending_reqs) {
entity->in_groups_with_pending_reqs = true;
+#ifdef CONFIG_BFQ_GROUP_IOSCHED
+ bfqq_group(bfqq)->num_queues_with_pending_reqs++;
+#endif
+ }
}
void bfq_del_bfqq_in_groups_with_pending_reqs(struct bfq_queue *bfqq)
{
struct bfq_entity *entity = &bfqq->entity;
- if (entity->in_groups_with_pending_reqs)
+ if (entity->in_groups_with_pending_reqs) {
entity->in_groups_with_pending_reqs = false;
+#ifdef CONFIG_BFQ_GROUP_IOSCHED
+ bfqq_group(bfqq)->num_queues_with_pending_reqs--;
+#endif
+ }
}
/*