2022-11-02 02:12:18

by Yu Kuai

[permalink] [raw]
Subject: [PATCH -next v4 0/5] multiple cleanup patches for bfqd

From: Yu Kuai <[email protected]>

Changes in v4:
- move first two patches from v3 into another thread.
- add patch 1

Changes in v3:
- resend v2 with new mail address

Changes in v2:
- add missing blank line in patch 1.
- remove patch 7,8, since they are wrong.
- add reviewed-by tag

Yu Kuai (5):
block, bfq: remove set but not used variable in
__bfq_entity_update_weight_prio
block, bfq: factor out code to update 'active_entities'
block, bfq: cleanup bfq_activate_requeue_entity()
block, bfq: remove dead code for updating 'rq_in_driver'
block, bfq: don't declare 'bfqd' as type 'void *' in bfq_group

block/bfq-cgroup.c | 2 +-
block/bfq-iosched.c | 16 ---------
block/bfq-iosched.h | 2 +-
block/bfq-wf2q.c | 88 ++++++++++++++++++---------------------------
4 files changed, 37 insertions(+), 71 deletions(-)

--
2.31.1



2022-11-02 02:14:17

by Yu Kuai

[permalink] [raw]
Subject: [PATCH -next v4 1/5] block, bfq: remove set but not used variable in __bfq_entity_update_weight_prio

From: Yu Kuai <[email protected]>

After the patch "block, bfq: cleanup bfq_weights_tree add/remove apis"),
the local variable 'bfqd' is not used anymore, thus remove it.

Signed-off-by: Yu Kuai <[email protected]>
---
block/bfq-wf2q.c | 15 ---------------
1 file changed, 15 deletions(-)

diff --git a/block/bfq-wf2q.c b/block/bfq-wf2q.c
index 5a02cb94d86e..2faa29fcb1e9 100644
--- a/block/bfq-wf2q.c
+++ b/block/bfq-wf2q.c
@@ -706,21 +706,6 @@ __bfq_entity_update_weight_prio(struct bfq_service_tree *old_st,
if (entity->prio_changed) {
struct bfq_queue *bfqq = bfq_entity_to_bfqq(entity);
unsigned int prev_weight, new_weight;
- struct bfq_data *bfqd = NULL;
-#ifdef CONFIG_BFQ_GROUP_IOSCHED
- struct bfq_sched_data *sd;
- struct bfq_group *bfqg;
-#endif
-
- if (bfqq)
- bfqd = bfqq->bfqd;
-#ifdef CONFIG_BFQ_GROUP_IOSCHED
- else {
- sd = entity->my_sched_data;
- bfqg = container_of(sd, struct bfq_group, sched_data);
- bfqd = (struct bfq_data *)bfqg->bfqd;
- }
-#endif

/* Matches the smp_wmb() in bfq_group_set_weight. */
smp_rmb();
--
2.31.1


2022-11-02 02:23:25

by Yu Kuai

[permalink] [raw]
Subject: [PATCH -next v4 5/5] block, bfq: don't declare 'bfqd' as type 'void *' in bfq_group

From: Yu Kuai <[email protected]>

Prevent unnecessary format conversion for bfqg->bfqd in multiple
places.

Signed-off-by: Yu Kuai <[email protected]>
Reviewed-by: Jan Kara <[email protected]>
Acked-by: Paolo Valente <[email protected]>
---
block/bfq-cgroup.c | 2 +-
block/bfq-iosched.h | 2 +-
block/bfq-wf2q.c | 6 ++----
3 files changed, 4 insertions(+), 6 deletions(-)

diff --git a/block/bfq-cgroup.c b/block/bfq-cgroup.c
index 4c37398e0b99..d57872cc05ed 100644
--- a/block/bfq-cgroup.c
+++ b/block/bfq-cgroup.c
@@ -224,7 +224,7 @@ void bfqg_stats_update_io_add(struct bfq_group *bfqg, struct bfq_queue *bfqq,
{
blkg_rwstat_add(&bfqg->stats.queued, opf, 1);
bfqg_stats_end_empty_time(&bfqg->stats);
- if (!(bfqq == ((struct bfq_data *)bfqg->bfqd)->in_service_queue))
+ if (!(bfqq == bfqg->bfqd->in_service_queue))
bfqg_stats_set_start_group_wait_time(bfqg, bfqq_group(bfqq));
}

diff --git a/block/bfq-iosched.h b/block/bfq-iosched.h
index 76363841d8ff..9fa89577322d 100644
--- a/block/bfq-iosched.h
+++ b/block/bfq-iosched.h
@@ -931,7 +931,7 @@ struct bfq_group {
struct bfq_entity entity;
struct bfq_sched_data sched_data;

- void *bfqd;
+ struct bfq_data *bfqd;

struct bfq_queue *async_bfqq[2][IOPRIO_NR_LEVELS];
struct bfq_queue *async_idle_bfqq;
diff --git a/block/bfq-wf2q.c b/block/bfq-wf2q.c
index 4d4b84e7bf3e..b02b53658ed4 100644
--- a/block/bfq-wf2q.c
+++ b/block/bfq-wf2q.c
@@ -222,9 +222,8 @@ static void bfq_inc_active_entities(struct bfq_entity *entity)
{
struct bfq_sched_data *sd = entity->sched_data;
struct bfq_group *bfqg = container_of(sd, struct bfq_group, sched_data);
- struct bfq_data *bfqd = (struct bfq_data *)bfqg->bfqd;

- if (bfqg != bfqd->root_group)
+ if (bfqg != bfqg->bfqd->root_group)
bfqg->active_entities++;
}

@@ -232,9 +231,8 @@ static void bfq_dec_active_entities(struct bfq_entity *entity)
{
struct bfq_sched_data *sd = entity->sched_data;
struct bfq_group *bfqg = container_of(sd, struct bfq_group, sched_data);
- struct bfq_data *bfqd = (struct bfq_data *)bfqg->bfqd;

- if (bfqg != bfqd->root_group)
+ if (bfqg != bfqg->bfqd->root_group)
bfqg->active_entities--;
}

--
2.31.1


2022-11-02 02:30:06

by Jens Axboe

[permalink] [raw]
Subject: Re: [PATCH -next v4 1/5] block, bfq: remove set but not used variable in __bfq_entity_update_weight_prio

On 11/1/22 8:25 PM, Yu Kuai wrote:
> From: Yu Kuai <[email protected]>
>
> After the patch "block, bfq: cleanup bfq_weights_tree add/remove apis"),
> the local variable 'bfqd' is not used anymore, thus remove it.

Please add a Fixes tag.

--
Jens Axboe



2022-11-02 02:37:31

by Yu Kuai

[permalink] [raw]
Subject: Re: [PATCH -next v4 1/5] block, bfq: remove set but not used variable in __bfq_entity_update_weight_prio

Hi,

在 2022/11/02 10:11, Jens Axboe 写道:
> On 11/1/22 8:09 PM, Jens Axboe wrote:
>> On 11/1/22 8:25 PM, Yu Kuai wrote:
>>> From: Yu Kuai <[email protected]>
>>>
>>> After the patch "block, bfq: cleanup bfq_weights_tree add/remove apis"),
>>> the local variable 'bfqd' is not used anymore, thus remove it.
>>
>> Please add a Fixes tag.
>
> Looks like the rest were good to go, so I added it myself.

Thanks for helping out. I'm not sure which commit id to use since the
fixed patch is not in linux-next yet, does the commit id stay the same
when the patch applied from for-6.2 to next ?

Thanks,
Kuai
>


2022-11-02 03:03:01

by Jens Axboe

[permalink] [raw]
Subject: Re: [PATCH -next v4 1/5] block, bfq: remove set but not used variable in __bfq_entity_update_weight_prio

On 11/1/22 8:09 PM, Jens Axboe wrote:
> On 11/1/22 8:25 PM, Yu Kuai wrote:
>> From: Yu Kuai <[email protected]>
>>
>> After the patch "block, bfq: cleanup bfq_weights_tree add/remove apis"),
>> the local variable 'bfqd' is not used anymore, thus remove it.
>
> Please add a Fixes tag.

Looks like the rest were good to go, so I added it myself.

--
Jens Axboe



2022-11-02 03:03:01

by Jens Axboe

[permalink] [raw]
Subject: Re: [PATCH -next v4 0/5] multiple cleanup patches for bfqd

On Wed, 2 Nov 2022 10:25:37 +0800, Yu Kuai wrote:
> From: Yu Kuai <[email protected]>
>
> Changes in v4:
> - move first two patches from v3 into another thread.
> - add patch 1
>
> Changes in v3:
> - resend v2 with new mail address
>
> [...]

Applied, thanks!

[1/5] block, bfq: remove set but not used variable in __bfq_entity_update_weight_prio
commit: 060d9217d356a28e1bcfd2df0c8bf59aa24a12ce
[2/5] block, bfq: factor out code to update 'active_entities'
commit: e5c63eb4b59f9fb9b28e29d605a4dabbeff7772e
[3/5] block, bfq: cleanup bfq_activate_requeue_entity()
commit: f6fd119b1ae2c4f794dffc87421cf4ce2414401e
[4/5] block, bfq: remove dead code for updating 'rq_in_driver'
commit: 918fdea3884ca8de93bd0e8ad02545eb8e3695d6
[5/5] block, bfq: don't declare 'bfqd' as type 'void *' in bfq_group
commit: aa625117d6f67e33fab280358855fdd332bb20ab

Best regards,
--
Jens Axboe



2022-11-02 03:03:49

by Jens Axboe

[permalink] [raw]
Subject: Re: [PATCH -next v4 1/5] block, bfq: remove set but not used variable in __bfq_entity_update_weight_prio

On 11/1/22 8:18 PM, Yu Kuai wrote:
> Hi,
>
> 在 2022/11/02 10:11, Jens Axboe 写道:
>> On 11/1/22 8:09 PM, Jens Axboe wrote:
>>> On 11/1/22 8:25 PM, Yu Kuai wrote:
>>>> From: Yu Kuai <[email protected]>
>>>>
>>>> After the patch "block, bfq: cleanup bfq_weights_tree add/remove apis"),
>>>> the local variable 'bfqd' is not used anymore, thus remove it.
>>>
>>> Please add a Fixes tag.
>>
>> Looks like the rest were good to go, so I added it myself.
>
> Thanks for helping out. I'm not sure which commit id to use since the
> fixed patch is not in linux-next yet, does the commit id stay the same
> when the patch applied from for-6.2 to next ?

linux-next shas are not stable, but since you're sending this to the
linux-block list and against the block tree, that's obviously where
you'd find that commit.

--
Jens Axboe