From: Yu Kuai <yukuai3@huawei.com> To: <paolo.valente@linaro.org>, <jack@suse.cz>, <axboe@kernel.dk>, <tj@kernel.org> Cc: <linux-block@vger.kernel.org>, <cgroups@vger.kernel.org>, <linux-kernel@vger.kernel.org>, <yukuai3@huawei.com>, <yi.zhang@huawei.com> Subject: [PATCH -next v8 2/4] block, bfq: record how many queues have pending requests Date: Tue, 31 May 2022 22:08:56 +0800 [thread overview] Message-ID: <20220531140858.3324294-3-yukuai3@huawei.com> (raw) In-Reply-To: <20220531140858.3324294-1-yukuai3@huawei.com> Prepare to refactor the counting of 'num_groups_with_pending_reqs'. Add a counter in bfq_group, and update it while tracking if bfqq have pending requests. Signed-off-by: Yu Kuai <yukuai3@huawei.com> --- block/bfq-cgroup.c | 1 + block/bfq-iosched.h | 1 + block/bfq-wf2q.c | 12 ++++++++++-- 3 files changed, 12 insertions(+), 2 deletions(-) diff --git a/block/bfq-cgroup.c b/block/bfq-cgroup.c index 09574af83566..0954a258a107 100644 --- a/block/bfq-cgroup.c +++ b/block/bfq-cgroup.c @@ -557,6 +557,7 @@ static void bfq_pd_init(struct blkg_policy_data *pd) */ bfqg->bfqd = bfqd; bfqg->active_entities = 0; + bfqg->num_queues_with_pending_reqs = 0; bfqg->online = true; bfqg->rq_pos_tree = RB_ROOT; } diff --git a/block/bfq-iosched.h b/block/bfq-iosched.h index 3b9b1a0e7c1c..a5f7c0c1a3b3 100644 --- a/block/bfq-iosched.h +++ b/block/bfq-iosched.h @@ -943,6 +943,7 @@ struct bfq_group { struct bfq_entity *my_entity; int active_entities; + int num_queues_with_pending_reqs; struct rb_root rq_pos_tree; diff --git a/block/bfq-wf2q.c b/block/bfq-wf2q.c index 12d20f26ad69..b533e17e9f0c 100644 --- a/block/bfq-wf2q.c +++ b/block/bfq-wf2q.c @@ -1651,16 +1651,24 @@ static 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 + } } /* -- 2.31.1
WARNING: multiple messages have this Message-ID (diff)
From: Yu Kuai <yukuai3@huawei.com> To: paolo.valente@linaro.org, jack@suse.cz, axboe@kernel.dk, tj@kernel.org Cc: linux-block@vger.kernel.org, cgroups@vger.kernel.org, linux-kernel@vger.kernel.org, yukuai3@huawei.com, yi.zhang@huawei.com Subject: [PATCH -next v8 2/4] block, bfq: record how many queues have pending requests Date: Tue, 31 May 2022 22:08:56 +0800 [thread overview] Message-ID: <20220531140858.3324294-3-yukuai3@huawei.com> (raw) In-Reply-To: <20220531140858.3324294-1-yukuai3@huawei.com> Prepare to refactor the counting of 'num_groups_with_pending_reqs'. Add a counter in bfq_group, and update it while tracking if bfqq have pending requests. Signed-off-by: Yu Kuai <yukuai3@huawei.com> --- block/bfq-cgroup.c | 1 + block/bfq-iosched.h | 1 + block/bfq-wf2q.c | 12 ++++++++++-- 3 files changed, 12 insertions(+), 2 deletions(-) diff --git a/block/bfq-cgroup.c b/block/bfq-cgroup.c index 09574af83566..0954a258a107 100644 --- a/block/bfq-cgroup.c +++ b/block/bfq-cgroup.c @@ -557,6 +557,7 @@ static void bfq_pd_init(struct blkg_policy_data *pd) */ bfqg->bfqd = bfqd; bfqg->active_entities = 0; + bfqg->num_queues_with_pending_reqs = 0; bfqg->online = true; bfqg->rq_pos_tree = RB_ROOT; } diff --git a/block/bfq-iosched.h b/block/bfq-iosched.h index 3b9b1a0e7c1c..a5f7c0c1a3b3 100644 --- a/block/bfq-iosched.h +++ b/block/bfq-iosched.h @@ -943,6 +943,7 @@ struct bfq_group { struct bfq_entity *my_entity; int active_entities; + int num_queues_with_pending_reqs; struct rb_root rq_pos_tree; diff --git a/block/bfq-wf2q.c b/block/bfq-wf2q.c index 12d20f26ad69..b533e17e9f0c 100644 --- a/block/bfq-wf2q.c +++ b/block/bfq-wf2q.c @@ -1651,16 +1651,24 @@ static 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 + } } /* -- 2.31.1
next prev parent reply other threads:[~2022-05-31 13:55 UTC|newest] Thread overview: 17+ messages / expand[flat|nested] mbox.gz Atom feed top 2022-05-31 14:08 [PATCH -next v8 0/4] support concurrent sync io for bfq on a specail occasion Yu Kuai 2022-05-31 14:08 ` Yu Kuai 2022-05-31 14:08 ` [PATCH -next v8 1/4] block, bfq: support to track if bfqq has pending requests Yu Kuai 2022-05-31 14:08 ` Yu Kuai 2022-06-01 8:31 ` Jan Kara 2022-05-31 14:08 ` Yu Kuai [this message] 2022-05-31 14:08 ` [PATCH -next v8 2/4] block, bfq: record how many queues have " Yu Kuai 2022-06-01 8:35 ` Jan Kara 2022-06-01 8:35 ` Jan Kara 2022-06-01 10:58 ` Yu Kuai 2022-06-01 10:58 ` Yu Kuai 2022-05-31 14:08 ` [PATCH -next v8 3/4] block, bfq: refactor the counting of 'num_groups_with_pending_reqs' Yu Kuai 2022-05-31 14:08 ` Yu Kuai 2022-06-01 8:37 ` Jan Kara 2022-05-31 14:08 ` [PATCH -next v8 4/4] block, bfq: do not idle if only one group is activated Yu Kuai 2022-05-31 14:08 ` Yu Kuai 2022-06-01 8:38 ` Jan Kara
Reply instructions: You may reply publicly to this message via plain-text email using any one of the following methods: * Save the following mbox file, import it into your mail client, and reply-to-all from there: mbox Avoid top-posting and favor interleaved quoting: https://en.wikipedia.org/wiki/Posting_style#Interleaved_style * Reply using the --to, --cc, and --in-reply-to switches of git-send-email(1): git send-email \ --in-reply-to=20220531140858.3324294-3-yukuai3@huawei.com \ --to=yukuai3@huawei.com \ --cc=axboe@kernel.dk \ --cc=cgroups@vger.kernel.org \ --cc=jack@suse.cz \ --cc=linux-block@vger.kernel.org \ --cc=linux-kernel@vger.kernel.org \ --cc=paolo.valente@linaro.org \ --cc=tj@kernel.org \ --cc=yi.zhang@huawei.com \ /path/to/YOUR_REPLY https://kernel.org/pub/software/scm/git/docs/git-send-email.html * If your mail client supports setting the In-Reply-To header via mailto: links, try the mailto: linkBe sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes, see mirroring instructions on how to clone and mirror all data and code used by this external index.