Skip to content

Commit

Permalink
block, bfq: avoid moving bfqq to it's parent bfqg
Browse files Browse the repository at this point in the history
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>
  • Loading branch information
Yu Kuai authored and Jens Axboe committed Feb 18, 2022
1 parent 43a4b1f commit c5e4cb0
Showing 1 changed file with 9 additions and 1 deletion.
10 changes: 9 additions & 1 deletion block/bfq-cgroup.c
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -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)
Expand Down

0 comments on commit c5e4cb0

Please sign in to comment.