Skip to content

Commit c5e4cb0

Browse files
YuKuai-huaweiaxboe
authored andcommitted
block, bfq: avoid moving bfqq to it's parent bfqg
Moving bfqq to it's parent bfqg is pointless. Signed-off-by: Yu Kuai <yukuai3@huawei.com> Link: https://lore.kernel.org/r/20220129015924.3958918-3-yukuai3@huawei.com Signed-off-by: Jens Axboe <axboe@kernel.dk>
1 parent 43a4b1f commit c5e4cb0

File tree

1 file changed

+9
-1
lines changed

1 file changed

+9
-1
lines changed

block/bfq-cgroup.c

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -645,6 +645,14 @@ void bfq_bfqq_move(struct bfq_data *bfqd, struct bfq_queue *bfqq,
645645
struct bfq_group *bfqg)
646646
{
647647
struct bfq_entity *entity = &bfqq->entity;
648+
struct bfq_group *old_parent = bfqq_group(bfqq);
649+
650+
/*
651+
* No point to move bfqq to the same group, which can happen when
652+
* root group is offlined
653+
*/
654+
if (old_parent == bfqg)
655+
return;
648656

649657
/*
650658
* 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,
666674
bfq_deactivate_bfqq(bfqd, bfqq, false, false);
667675
else if (entity->on_st_or_in_serv)
668676
bfq_put_idle_entity(bfq_entity_service_tree(entity), entity);
669-
bfqg_and_blkg_put(bfqq_group(bfqq));
677+
bfqg_and_blkg_put(old_parent);
670678

671679
if (entity->parent &&
672680
entity->parent->last_bfqq_created == bfqq)

0 commit comments

Comments
 (0)