lkml.org 
[lkml]   [2021]   [Jun]   [10]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
/
SubjectRe: [RESEND PATCH 1/8] bfq: introduce bfq_entity_to_bfqg helper method
From
Date


Oleksandr Natalenko wrote on 2021/6/10 16:31:
> Hello.
>
> On Thu, Jun 10, 2021 at 03:22:30PM +0800, brookxu wrote:
>> From: Chunguang Xu <brookxu@tencent.com>
>>
>> Introduce bfq_entity_to_bfqg() to make it easier to obtain the
>> bfq_group corresponding to the entity.
>>
>> Signed-off-by: Chunguang Xu <brookxu@tencent.com>
>> ---
>> block/bfq-cgroup.c | 6 ++----
>> block/bfq-iosched.h | 1 +
>> block/bfq-wf2q.c | 16 ++++++++++++----
>> 3 files changed, 15 insertions(+), 8 deletions(-)
>>
>> diff --git a/block/bfq-cgroup.c b/block/bfq-cgroup.c
>> index b791e20..a5f544a 100644
>> --- a/block/bfq-cgroup.c
>> +++ b/block/bfq-cgroup.c
>> @@ -309,8 +309,7 @@ struct bfq_group *bfqq_group(struct bfq_queue *bfqq)
>> {
>> struct bfq_entity *group_entity = bfqq->entity.parent;
>>
>> - return group_entity ? container_of(group_entity, struct bfq_group,
>> - entity) :
>> + return group_entity ? bfq_entity_to_bfqg(group_entity) :
>> bfqq->bfqd->root_group;
>> }
>>
>> @@ -610,8 +609,7 @@ struct bfq_group *bfq_find_set_group(struct bfq_data *bfqd,
>> */
>> entity = &bfqg->entity;
>> for_each_entity(entity) {
>> - struct bfq_group *curr_bfqg = container_of(entity,
>> - struct bfq_group, entity);
>> + struct bfq_group *curr_bfqg = bfq_entity_to_bfqg(entity);
>> if (curr_bfqg != bfqd->root_group) {
>> parent = bfqg_parent(curr_bfqg);
>> if (!parent)
>> diff --git a/block/bfq-iosched.h b/block/bfq-iosched.h
>> index b8e793c..a6f98e9 100644
>> --- a/block/bfq-iosched.h
>> +++ b/block/bfq-iosched.h
>> @@ -941,6 +941,7 @@ struct bfq_group {
>> #endif
>>
>> struct bfq_queue *bfq_entity_to_bfqq(struct bfq_entity *entity);
>> +struct bfq_group *bfq_entity_to_bfqg(struct bfq_entity *entity);
>>
>> /* --------------- main algorithm interface ----------------- */
>>
>> diff --git a/block/bfq-wf2q.c b/block/bfq-wf2q.c
>> index 070e34a..5ff0028 100644
>> --- a/block/bfq-wf2q.c
>> +++ b/block/bfq-wf2q.c
>> @@ -149,7 +149,7 @@ struct bfq_group *bfq_bfqq_to_bfqg(struct bfq_queue *bfqq)
>> if (!group_entity)
>> group_entity = &bfqq->bfqd->root_group->entity;
>>
>> - return container_of(group_entity, struct bfq_group, entity);
>> + return bfq_entity_to_bfqg(group_entity);
>> }
>>
>> /*
>> @@ -208,7 +208,7 @@ static bool bfq_no_longer_next_in_service(struct bfq_entity *entity)
>> if (bfq_entity_to_bfqq(entity))
>> return true;
>>
>> - bfqg = container_of(entity, struct bfq_group, entity);
>> + bfqg = bfq_entity_to_bfqg(entity);
>>
>> /*
>> * The field active_entities does not always contain the
>> @@ -266,6 +266,15 @@ struct bfq_queue *bfq_entity_to_bfqq(struct bfq_entity *entity)
>> return bfqq;
>> }
>>
>> +struct bfq_group *bfq_entity_to_bfqg(struct bfq_entity *entity)
>> +{
>> + struct bfq_group *bfqg = NULL;
>> +
>> + if (entity->my_sched_data)
>> + bfqg = container_of(entity, struct bfq_group, entity);
>> +
>> + return bfqg;
>> +}
>>
>> /**
>> * bfq_delta - map service into the virtual time domain.
>> @@ -1001,8 +1010,7 @@ static void __bfq_activate_entity(struct bfq_entity *entity,
>>
>> #ifdef CONFIG_BFQ_GROUP_IOSCHED
>> if (!bfq_entity_to_bfqq(entity)) { /* bfq_group */
>> - struct bfq_group *bfqg =
>> - container_of(entity, struct bfq_group, entity);
>> + struct bfq_group *bfqg = bfq_entity_to_bfqg(entity);
>> struct bfq_data *bfqd = bfqg->bfqd;
>>
>> if (!entity->in_groups_with_pending_reqs) {
>> --
>> 1.8.3.1
>>
>
> If it is a resend only, I can offer my Tested-by since I'm running this
> series for quite some time already.
>

ok, thank you very much.

> Thanks.
>

\
 
 \ /
  Last update: 2021-06-10 11:07    [W:0.130 / U:0.060 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site