mbox series

[0/8] bfq: misc updates

Message ID cover.1618916839.git.brookxu@tencent.com (mailing list archive)
Headers show
Series bfq: misc updates | expand

Message

brookxu April 20, 2021, 11:20 a.m. UTC
From: Chunguang Xu <brookxu@tencent.com>

Some misc updates, put together mainly to facilitate patch management.

Chunguang Xu (8):
  bfq: introduce bfq_entity_to_bfqg helper method
  bfq: convert the type of bfq_group.bfqd to bfq_data*
  bfq: limit the IO depth of CLASS_IDLE to 1
  bfq: keep the minimun bandwidth for CLASS_BE
  bfq: remove unnecessary initialization logic
  bfq: optimize the calculation of bfq_weight_to_ioprio()
  bfq: reset entity->prio_changed in bfq_init_entity()
  bfq: remove unnecessary BFQ_DEFAULT_GRP_IOPRIO

 block/bfq-cgroup.c  | 13 +++-----
 block/bfq-iosched.c | 17 +++++++++--
 block/bfq-iosched.h | 15 ++++++----
 block/bfq-wf2q.c    | 86 +++++++++++++++++++++++++++++++++++++----------------
 4 files changed, 88 insertions(+), 43 deletions(-)

Comments

Oleksandr Natalenko June 10, 2021, 8:31 a.m. UTC | #1
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.

Thanks.
brookxu June 10, 2021, 9:05 a.m. UTC | #2
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.
>
Piotr Górski June 10, 2021, 9:18 a.m. UTC | #3
Tested-by: Piotr Gorski <lucjan.lucjanov@gmail.com>

I have been testing this since the first release and have not noticed
any irregularities.

czw., 10 cze 2021 o 10:31 Oleksandr Natalenko
<oleksandr@natalenko.name> napisał(a):
>
> 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.
>
> Thanks.
>
> --
>   Oleksandr Natalenko (post-factum)