summaryrefslogtreecommitdiffstats
path: root/block
diff options
context:
space:
mode:
authorYu Kuai <yukuai3@huawei.com>2022-01-29 09:59:23 +0800
committerJens Axboe <axboe@kernel.dk>2022-02-18 06:13:00 -0700
commitc5e4cb0fcbbaa5ad853818c4a2383e9bd147fad6 (patch)
tree1bac305953bb5ba16f60cddcf26974ce735d1f76 /block
parent43a4b1fee098bd38eed9c334d0e0df221ecdf719 (diff)
downloadlinux-c5e4cb0fcbbaa5ad853818c4a2383e9bd147fad6.tar.bz2
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>
Diffstat (limited to 'block')
-rw-r--r--block/bfq-cgroup.c10
1 files changed, 9 insertions, 1 deletions
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)