linux-block.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH v1] block, bfq: do the all counting of pending-request if CONFIG_BFQ_GROUP_IOSCHED is enabled
@ 2022-11-10 11:26 Yuwei Guan
  2022-11-14  3:33 ` Yu Kuai
  2022-12-15 12:12 ` Jens Axboe
  0 siblings, 2 replies; 5+ messages in thread
From: Yuwei Guan @ 2022-11-10 11:26 UTC (permalink / raw)
  To: paolo.valente, axboe; +Cc: linux-block, linux-kernel, Yuwei.Guan, Yu Kuai

The 'bfqd->num_groups_with_pending_reqs' is used when
CONFIG_BFQ_GROUP_IOSCHED is enabled, so let the variables and processes
take effect when ONFIG_BFQ_GROUP_IOSCHED is enabled.

Cc: Yu Kuai <yukuai3@huawei.com>
Signed-off-by: Yuwei Guan <Yuwei.Guan@zeekrlife.com>
---
 block/bfq-iosched.c | 2 ++
 block/bfq-iosched.h | 4 ++++
 block/bfq-wf2q.c    | 8 ++++----
 3 files changed, 10 insertions(+), 4 deletions(-)

diff --git a/block/bfq-iosched.c b/block/bfq-iosched.c
index 2381cf220ba2..5f54091e7fe9 100644
--- a/block/bfq-iosched.c
+++ b/block/bfq-iosched.c
@@ -7051,7 +7051,9 @@ static int bfq_init_queue(struct request_queue *q, struct elevator_type *e)
 	bfqd->idle_slice_timer.function = bfq_idle_slice_timer;
 
 	bfqd->queue_weights_tree = RB_ROOT_CACHED;
+#ifdef CONFIG_BFQ_GROUP_IOSCHED
 	bfqd->num_groups_with_pending_reqs = 0;
+#endif
 
 	INIT_LIST_HEAD(&bfqd->active_list);
 	INIT_LIST_HEAD(&bfqd->idle_list);
diff --git a/block/bfq-iosched.h b/block/bfq-iosched.h
index 9fa89577322d..41aa151ccc22 100644
--- a/block/bfq-iosched.h
+++ b/block/bfq-iosched.h
@@ -197,8 +197,10 @@ struct bfq_entity {
 	/* flag, set to request a weight, ioprio or ioprio_class change  */
 	int prio_changed;
 
+#ifdef CONFIG_BFQ_GROUP_IOSCHED
 	/* flag, set if the entity is counted in groups_with_pending_reqs */
 	bool in_groups_with_pending_reqs;
+#endif
 
 	/* last child queue of entity created (for non-leaf entities) */
 	struct bfq_queue *last_bfqq_created;
@@ -491,6 +493,7 @@ struct bfq_data {
 	 */
 	struct rb_root_cached queue_weights_tree;
 
+#ifdef CONFIG_BFQ_GROUP_IOSCHED
 	/*
 	 * Number of groups with at least one process that
 	 * has at least one request waiting for completion. Note that
@@ -538,6 +541,7 @@ struct bfq_data {
 	 * with no request waiting for completion.
 	 */
 	unsigned int num_groups_with_pending_reqs;
+#endif
 
 	/*
 	 * Per-class (RT, BE, IDLE) number of bfq_queues containing
diff --git a/block/bfq-wf2q.c b/block/bfq-wf2q.c
index b02b53658ed4..ea4c3d757fdd 100644
--- a/block/bfq-wf2q.c
+++ b/block/bfq-wf2q.c
@@ -1612,28 +1612,28 @@ void bfq_requeue_bfqq(struct bfq_data *bfqd, struct bfq_queue *bfqq,
 
 void bfq_add_bfqq_in_groups_with_pending_reqs(struct bfq_queue *bfqq)
 {
+#ifdef CONFIG_BFQ_GROUP_IOSCHED
 	struct bfq_entity *entity = &bfqq->entity;
 
 	if (!entity->in_groups_with_pending_reqs) {
 		entity->in_groups_with_pending_reqs = true;
-#ifdef CONFIG_BFQ_GROUP_IOSCHED
 		if (!(bfqq_group(bfqq)->num_queues_with_pending_reqs++))
 			bfqq->bfqd->num_groups_with_pending_reqs++;
-#endif
 	}
+#endif
 }
 
 void bfq_del_bfqq_in_groups_with_pending_reqs(struct bfq_queue *bfqq)
 {
+#ifdef CONFIG_BFQ_GROUP_IOSCHED
 	struct bfq_entity *entity = &bfqq->entity;
 
 	if (entity->in_groups_with_pending_reqs) {
 		entity->in_groups_with_pending_reqs = false;
-#ifdef CONFIG_BFQ_GROUP_IOSCHED
 		if (!(--bfqq_group(bfqq)->num_queues_with_pending_reqs))
 			bfqq->bfqd->num_groups_with_pending_reqs--;
-#endif
 	}
+#endif
 }
 
 /*
-- 
2.34.1


^ permalink raw reply related	[flat|nested] 5+ messages in thread

* Re: [PATCH v1] block, bfq: do the all counting of pending-request if CONFIG_BFQ_GROUP_IOSCHED is enabled
  2022-11-10 11:26 [PATCH v1] block, bfq: do the all counting of pending-request if CONFIG_BFQ_GROUP_IOSCHED is enabled Yuwei Guan
@ 2022-11-14  3:33 ` Yu Kuai
  2022-12-15  1:48   ` Yuwei Guan
  2022-12-15 12:12 ` Jens Axboe
  1 sibling, 1 reply; 5+ messages in thread
From: Yu Kuai @ 2022-11-14  3:33 UTC (permalink / raw)
  To: Yuwei Guan, paolo.valente, axboe
  Cc: linux-block, linux-kernel, Yuwei.Guan, yukuai (C)

Hi,

在 2022/11/10 19:26, Yuwei Guan 写道:
> The 'bfqd->num_groups_with_pending_reqs' is used when
> CONFIG_BFQ_GROUP_IOSCHED is enabled, so let the variables and processes
> take effect when ONFIG_BFQ_GROUP_IOSCHED is enabled.
> 

This patch looks good to me, fell free to add:
Reviewed-by: Yu Kuai <yukuai3@huawei.com>

BTW, this patch need to be reviewed by Jan or Paolo before it can be
applied.

Thanks,
Kuai

> Cc: Yu Kuai <yukuai3@huawei.com>
> Signed-off-by: Yuwei Guan <Yuwei.Guan@zeekrlife.com>
> ---
>   block/bfq-iosched.c | 2 ++
>   block/bfq-iosched.h | 4 ++++
>   block/bfq-wf2q.c    | 8 ++++----
>   3 files changed, 10 insertions(+), 4 deletions(-)
> 
> diff --git a/block/bfq-iosched.c b/block/bfq-iosched.c
> index 2381cf220ba2..5f54091e7fe9 100644
> --- a/block/bfq-iosched.c
> +++ b/block/bfq-iosched.c
> @@ -7051,7 +7051,9 @@ static int bfq_init_queue(struct request_queue *q, struct elevator_type *e)
>   	bfqd->idle_slice_timer.function = bfq_idle_slice_timer;
>   
>   	bfqd->queue_weights_tree = RB_ROOT_CACHED;
> +#ifdef CONFIG_BFQ_GROUP_IOSCHED
>   	bfqd->num_groups_with_pending_reqs = 0;
> +#endif
>   
>   	INIT_LIST_HEAD(&bfqd->active_list);
>   	INIT_LIST_HEAD(&bfqd->idle_list);
> diff --git a/block/bfq-iosched.h b/block/bfq-iosched.h
> index 9fa89577322d..41aa151ccc22 100644
> --- a/block/bfq-iosched.h
> +++ b/block/bfq-iosched.h
> @@ -197,8 +197,10 @@ struct bfq_entity {
>   	/* flag, set to request a weight, ioprio or ioprio_class change  */
>   	int prio_changed;
>   
> +#ifdef CONFIG_BFQ_GROUP_IOSCHED
>   	/* flag, set if the entity is counted in groups_with_pending_reqs */
>   	bool in_groups_with_pending_reqs;
> +#endif
>   
>   	/* last child queue of entity created (for non-leaf entities) */
>   	struct bfq_queue *last_bfqq_created;
> @@ -491,6 +493,7 @@ struct bfq_data {
>   	 */
>   	struct rb_root_cached queue_weights_tree;
>   
> +#ifdef CONFIG_BFQ_GROUP_IOSCHED
>   	/*
>   	 * Number of groups with at least one process that
>   	 * has at least one request waiting for completion. Note that
> @@ -538,6 +541,7 @@ struct bfq_data {
>   	 * with no request waiting for completion.
>   	 */
>   	unsigned int num_groups_with_pending_reqs;
> +#endif
>   
>   	/*
>   	 * Per-class (RT, BE, IDLE) number of bfq_queues containing
> diff --git a/block/bfq-wf2q.c b/block/bfq-wf2q.c
> index b02b53658ed4..ea4c3d757fdd 100644
> --- a/block/bfq-wf2q.c
> +++ b/block/bfq-wf2q.c
> @@ -1612,28 +1612,28 @@ void bfq_requeue_bfqq(struct bfq_data *bfqd, struct bfq_queue *bfqq,
>   
>   void bfq_add_bfqq_in_groups_with_pending_reqs(struct bfq_queue *bfqq)
>   {
> +#ifdef CONFIG_BFQ_GROUP_IOSCHED
>   	struct bfq_entity *entity = &bfqq->entity;
>   
>   	if (!entity->in_groups_with_pending_reqs) {
>   		entity->in_groups_with_pending_reqs = true;
> -#ifdef CONFIG_BFQ_GROUP_IOSCHED
>   		if (!(bfqq_group(bfqq)->num_queues_with_pending_reqs++))
>   			bfqq->bfqd->num_groups_with_pending_reqs++;
> -#endif
>   	}
> +#endif
>   }
>   
>   void bfq_del_bfqq_in_groups_with_pending_reqs(struct bfq_queue *bfqq)
>   {
> +#ifdef CONFIG_BFQ_GROUP_IOSCHED
>   	struct bfq_entity *entity = &bfqq->entity;
>   
>   	if (entity->in_groups_with_pending_reqs) {
>   		entity->in_groups_with_pending_reqs = false;
> -#ifdef CONFIG_BFQ_GROUP_IOSCHED
>   		if (!(--bfqq_group(bfqq)->num_queues_with_pending_reqs))
>   			bfqq->bfqd->num_groups_with_pending_reqs--;
> -#endif
>   	}
> +#endif
>   }
>   
>   /*
> 


^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: [PATCH v1] block, bfq: do the all counting of pending-request if CONFIG_BFQ_GROUP_IOSCHED is enabled
  2022-11-14  3:33 ` Yu Kuai
@ 2022-12-15  1:48   ` Yuwei Guan
  2022-12-15 10:27     ` Jan Kara
  0 siblings, 1 reply; 5+ messages in thread
From: Yuwei Guan @ 2022-12-15  1:48 UTC (permalink / raw)
  To: Yu Kuai, Jan Kara
  Cc: paolo.valente, axboe, linux-block, linux-kernel, Yuwei.Guan, yukuai (C)

Yu Kuai <yukuai1@huaweicloud.com> 于2022年11月14日周一 11:33写道:
>
> Hi,
>
> 在 2022/11/10 19:26, Yuwei Guan 写道:
> > The 'bfqd->num_groups_with_pending_reqs' is used when
> > CONFIG_BFQ_GROUP_IOSCHED is enabled, so let the variables and processes
> > take effect when ONFIG_BFQ_GROUP_IOSCHED is enabled.
> >
>
> This patch looks good to me, fell free to add:
> Reviewed-by: Yu Kuai <yukuai3@huawei.com>
>
> BTW, this patch need to be reviewed by Jan or Paolo before it can be
> applied.
>
Hi Jan,

Could you help to review this patch.

Thanks.

> Thanks,
> Kuai
>
> > Cc: Yu Kuai <yukuai3@huawei.com>
> > Signed-off-by: Yuwei Guan <Yuwei.Guan@zeekrlife.com>
> > ---
> >   block/bfq-iosched.c | 2 ++
> >   block/bfq-iosched.h | 4 ++++
> >   block/bfq-wf2q.c    | 8 ++++----
> >   3 files changed, 10 insertions(+), 4 deletions(-)
> >
> > diff --git a/block/bfq-iosched.c b/block/bfq-iosched.c
> > index 2381cf220ba2..5f54091e7fe9 100644
> > --- a/block/bfq-iosched.c
> > +++ b/block/bfq-iosched.c
> > @@ -7051,7 +7051,9 @@ static int bfq_init_queue(struct request_queue *q, struct elevator_type *e)
> >       bfqd->idle_slice_timer.function = bfq_idle_slice_timer;
> >
> >       bfqd->queue_weights_tree = RB_ROOT_CACHED;
> > +#ifdef CONFIG_BFQ_GROUP_IOSCHED
> >       bfqd->num_groups_with_pending_reqs = 0;
> > +#endif
> >
> >       INIT_LIST_HEAD(&bfqd->active_list);
> >       INIT_LIST_HEAD(&bfqd->idle_list);
> > diff --git a/block/bfq-iosched.h b/block/bfq-iosched.h
> > index 9fa89577322d..41aa151ccc22 100644
> > --- a/block/bfq-iosched.h
> > +++ b/block/bfq-iosched.h
> > @@ -197,8 +197,10 @@ struct bfq_entity {
> >       /* flag, set to request a weight, ioprio or ioprio_class change  */
> >       int prio_changed;
> >
> > +#ifdef CONFIG_BFQ_GROUP_IOSCHED
> >       /* flag, set if the entity is counted in groups_with_pending_reqs */
> >       bool in_groups_with_pending_reqs;
> > +#endif
> >
> >       /* last child queue of entity created (for non-leaf entities) */
> >       struct bfq_queue *last_bfqq_created;
> > @@ -491,6 +493,7 @@ struct bfq_data {
> >        */
> >       struct rb_root_cached queue_weights_tree;
> >
> > +#ifdef CONFIG_BFQ_GROUP_IOSCHED
> >       /*
> >        * Number of groups with at least one process that
> >        * has at least one request waiting for completion. Note that
> > @@ -538,6 +541,7 @@ struct bfq_data {
> >        * with no request waiting for completion.
> >        */
> >       unsigned int num_groups_with_pending_reqs;
> > +#endif
> >
> >       /*
> >        * Per-class (RT, BE, IDLE) number of bfq_queues containing
> > diff --git a/block/bfq-wf2q.c b/block/bfq-wf2q.c
> > index b02b53658ed4..ea4c3d757fdd 100644
> > --- a/block/bfq-wf2q.c
> > +++ b/block/bfq-wf2q.c
> > @@ -1612,28 +1612,28 @@ void bfq_requeue_bfqq(struct bfq_data *bfqd, struct bfq_queue *bfqq,
> >
> >   void bfq_add_bfqq_in_groups_with_pending_reqs(struct bfq_queue *bfqq)
> >   {
> > +#ifdef CONFIG_BFQ_GROUP_IOSCHED
> >       struct bfq_entity *entity = &bfqq->entity;
> >
> >       if (!entity->in_groups_with_pending_reqs) {
> >               entity->in_groups_with_pending_reqs = true;
> > -#ifdef CONFIG_BFQ_GROUP_IOSCHED
> >               if (!(bfqq_group(bfqq)->num_queues_with_pending_reqs++))
> >                       bfqq->bfqd->num_groups_with_pending_reqs++;
> > -#endif
> >       }
> > +#endif
> >   }
> >
> >   void bfq_del_bfqq_in_groups_with_pending_reqs(struct bfq_queue *bfqq)
> >   {
> > +#ifdef CONFIG_BFQ_GROUP_IOSCHED
> >       struct bfq_entity *entity = &bfqq->entity;
> >
> >       if (entity->in_groups_with_pending_reqs) {
> >               entity->in_groups_with_pending_reqs = false;
> > -#ifdef CONFIG_BFQ_GROUP_IOSCHED
> >               if (!(--bfqq_group(bfqq)->num_queues_with_pending_reqs))
> >                       bfqq->bfqd->num_groups_with_pending_reqs--;
> > -#endif
> >       }
> > +#endif
> >   }
> >
> >   /*
> >
>

^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: [PATCH v1] block, bfq: do the all counting of pending-request if CONFIG_BFQ_GROUP_IOSCHED is enabled
  2022-12-15  1:48   ` Yuwei Guan
@ 2022-12-15 10:27     ` Jan Kara
  0 siblings, 0 replies; 5+ messages in thread
From: Jan Kara @ 2022-12-15 10:27 UTC (permalink / raw)
  To: Yuwei Guan
  Cc: Yu Kuai, Jan Kara, paolo.valente, axboe, linux-block,
	linux-kernel, Yuwei.Guan, yukuai (C)

Hello Yuwei!

On Thu 15-12-22 09:48:59, Yuwei Guan wrote:
> Yu Kuai <yukuai1@huaweicloud.com> 于2022年11月14日周一 11:33写道:
> >
> > Hi,
> >
> > 在 2022/11/10 19:26, Yuwei Guan 写道:
> > > The 'bfqd->num_groups_with_pending_reqs' is used when
> > > CONFIG_BFQ_GROUP_IOSCHED is enabled, so let the variables and processes
> > > take effect when ONFIG_BFQ_GROUP_IOSCHED is enabled.
> > >
> >
> > This patch looks good to me, fell free to add:
> > Reviewed-by: Yu Kuai <yukuai3@huawei.com>
> >
> > BTW, this patch need to be reviewed by Jan or Paolo before it can be
> > applied.
> 
> Could you help to review this patch.

Yeah, the patch looks good to me. Feel free to add:

Reviewed-by: Jan Kara <jack@suse.cz>

								Honza
-- 
Jan Kara <jack@suse.com>
SUSE Labs, CR

^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: [PATCH v1] block, bfq: do the all counting of pending-request if CONFIG_BFQ_GROUP_IOSCHED is enabled
  2022-11-10 11:26 [PATCH v1] block, bfq: do the all counting of pending-request if CONFIG_BFQ_GROUP_IOSCHED is enabled Yuwei Guan
  2022-11-14  3:33 ` Yu Kuai
@ 2022-12-15 12:12 ` Jens Axboe
  1 sibling, 0 replies; 5+ messages in thread
From: Jens Axboe @ 2022-12-15 12:12 UTC (permalink / raw)
  To: paolo.valente, Yuwei Guan; +Cc: linux-block, linux-kernel, Yuwei.Guan, Yu Kuai


On Thu, 10 Nov 2022 19:26:22 +0800, Yuwei Guan wrote:
> The 'bfqd->num_groups_with_pending_reqs' is used when
> CONFIG_BFQ_GROUP_IOSCHED is enabled, so let the variables and processes
> take effect when ONFIG_BFQ_GROUP_IOSCHED is enabled.
> 
> 

Applied, thanks!

[1/1] block, bfq: do the all counting of pending-request if CONFIG_BFQ_GROUP_IOSCHED is enabled
      commit: 1eb206208b0f3f707c67134ef6ba394410effb67

Best regards,
-- 
Jens Axboe



^ permalink raw reply	[flat|nested] 5+ messages in thread

end of thread, other threads:[~2022-12-15 12:13 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2022-11-10 11:26 [PATCH v1] block, bfq: do the all counting of pending-request if CONFIG_BFQ_GROUP_IOSCHED is enabled Yuwei Guan
2022-11-14  3:33 ` Yu Kuai
2022-12-15  1:48   ` Yuwei Guan
2022-12-15 10:27     ` Jan Kara
2022-12-15 12:12 ` Jens Axboe

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).