diff mbox series

[v3,2/3] block, bfq: avoid moving bfqq to it's parent bfqg

Message ID 20220129015924.3958918-3-yukuai3@huawei.com (mailing list archive)
State New, archived
Headers show
Series block, bfq: minor cleanup and fix | expand

Commit Message

Yu Kuai Jan. 29, 2022, 1:59 a.m. UTC
Moving bfqq to it's parent bfqg is pointless.

Signed-off-by: Yu Kuai <yukuai3@huawei.com>
---
 block/bfq-cgroup.c | 10 +++++++++-
 1 file changed, 9 insertions(+), 1 deletion(-)

Comments

Yu Kuai Feb. 8, 2022, 3:53 a.m. UTC | #1
在 2022/01/29 9:59, Yu Kuai 写道:
> Moving bfqq to it's parent bfqg is pointless.
> 
> Signed-off-by: Yu Kuai <yukuai3@huawei.com>
> ---
>   block/bfq-cgroup.c | 10 +++++++++-
>   1 file changed, 9 insertions(+), 1 deletion(-)

Hi, Paolo

I make a clerical error in last version of this patch:

bfq_group should be bfqq_group

Can you please take a look of this patch? I do compile and
test the patch this time...

Thanks,
Kuai
Paolo Valente Feb. 8, 2022, 4:07 p.m. UTC | #2
> Il giorno 8 feb 2022, alle ore 04:53, yukuai (C) <yukuai3@huawei.com> ha scritto:
> 
> 在 2022/01/29 9:59, Yu Kuai 写道:
>> Moving bfqq to it's parent bfqg is pointless.
>> Signed-off-by: Yu Kuai <yukuai3@huawei.com>
>> ---
>>  block/bfq-cgroup.c | 10 +++++++++-
>>  1 file changed, 9 insertions(+), 1 deletion(-)
> 
> Hi, Paolo
> 
> I make a clerical error in last version of this patch:
> 
> bfq_group should be bfqq_group
> 
> Can you please take a look of this patch? I do compile and
> test the patch this time...
> 

Haven't I acked this patch series already?

Thanks,
Paolo

> Thanks,
> Kuai
diff mbox series

Patch

diff --git a/block/bfq-cgroup.c b/block/bfq-cgroup.c
index 24a5c5329bcd..9783c1156159 100644
--- a/block/bfq-cgroup.c
+++ b/block/bfq-cgroup.c
@@ -645,6 +645,14 @@  void bfq_bfqq_move(struct bfq_data *bfqd, struct bfq_queue *bfqq,
 		   struct bfq_group *bfqg)
 {
 	struct bfq_entity *entity = &bfqq->entity;
+	struct bfq_group *old_parent = bfqq_group(bfqq);
+
+	/*
+	 * No point to move bfqq to the same group, which can happen when
+	 * root group is offlined
+	 */
+	if (old_parent == bfqg)
+		return;
 
 	/*
 	 * Get extra reference to prevent bfqq from being freed in
@@ -666,7 +674,7 @@  void bfq_bfqq_move(struct bfq_data *bfqd, struct bfq_queue *bfqq,
 		bfq_deactivate_bfqq(bfqd, bfqq, false, false);
 	else if (entity->on_st_or_in_serv)
 		bfq_put_idle_entity(bfq_entity_service_tree(entity), entity);
-	bfqg_and_blkg_put(bfqq_group(bfqq));
+	bfqg_and_blkg_put(old_parent);
 
 	if (entity->parent &&
 	    entity->parent->last_bfqq_created == bfqq)