[<prev] [next>] [<thread-prev] [day] [month] [year] [list]
Message-ID: <3ab7ab6e-474d-d5d7-a1c0-f75b3b092bbe@huawei.com>
Date: Wed, 1 Jun 2022 18:58:00 +0800
From: Yu Kuai <yukuai3@...wei.com>
To: Jan Kara <jack@...e.cz>
CC: <paolo.valente@...aro.org>, <axboe@...nel.dk>, <tj@...nel.org>,
<linux-block@...r.kernel.org>, <cgroups@...r.kernel.org>,
<linux-kernel@...r.kernel.org>, <yi.zhang@...wei.com>
Subject: Re: [PATCH -next v8 2/4] block, bfq: record how many queues have
pending requests
在 2022/06/01 16:35, Jan Kara 写道:
> On Tue 31-05-22 22:08:56, Yu Kuai wrote:
>> 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@...wei.com>
>
> Looks good, except I think that we also need to update the counters
> 'num_groups_with_pending_reqs' in bfq_move_bfqq()?
Yes, you're right. I'll do that in next version.
Thanks,
Kuai
>
> Honza
>
>> ---
>> 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
>>
Powered by blists - more mailing lists