summaryrefslogtreecommitdiff
path: root/block
diff options
context:
space:
mode:
authorPaolo Valente <paolo.valente@linaro.org>2020-03-21 10:45:21 +0100
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>2020-04-23 10:36:26 +0200
commita362482b2325fc5fb522b1786225fb8d868590c5 (patch)
treec1b8db7914414c4075cc852bafc78d2ab5ee373b /block
parent839b7cd1d8bce99a04a77ba69105c8277c77ee15 (diff)
block, bfq: invoke flush_idle_tree after reparent_active_queues in pd_offline
commit 4d38a87fbb77fb9ff2ff4e914162a8ae6453eff5 upstream. In bfq_pd_offline(), the function bfq_flush_idle_tree() is invoked to flush the rb tree that contains all idle entities belonging to the pd (cgroup) being destroyed. In particular, bfq_flush_idle_tree() is invoked before bfq_reparent_active_queues(). Yet the latter may happen to add some entities to the idle tree. It happens if, in some of the calls to bfq_bfqq_move() performed by bfq_reparent_active_queues(), the queue to move is empty and gets expired. This commit simply reverses the invocation order between bfq_flush_idle_tree() and bfq_reparent_active_queues(). Tested-by: cki-project@redhat.com Signed-off-by: Paolo Valente <paolo.valente@linaro.org> Signed-off-by: Jens Axboe <axboe@kernel.dk> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Diffstat (limited to 'block')
-rw-r--r--block/bfq-cgroup.c20
1 files changed, 13 insertions, 7 deletions
diff --git a/block/bfq-cgroup.c b/block/bfq-cgroup.c
index 85c3a2bd6911..12b707a4e52f 100644
--- a/block/bfq-cgroup.c
+++ b/block/bfq-cgroup.c
@@ -877,13 +877,6 @@ static void bfq_pd_offline(struct blkg_policy_data *pd)
st = bfqg->sched_data.service_tree + i;
/*
- * The idle tree may still contain bfq_queues belonging
- * to exited task because they never migrated to a different
- * cgroup from the one being destroyed now.
- */
- bfq_flush_idle_tree(st);
-
- /*
* It may happen that some queues are still active
* (busy) upon group destruction (if the corresponding
* processes have been forced to terminate). We move
@@ -896,6 +889,19 @@ static void bfq_pd_offline(struct blkg_policy_data *pd)
* scheduler has taken no reference.
*/
bfq_reparent_active_queues(bfqd, bfqg, st, i);
+
+ /*
+ * The idle tree may still contain bfq_queues
+ * belonging to exited task because they never
+ * migrated to a different cgroup from the one being
+ * destroyed now. In addition, even
+ * bfq_reparent_active_queues() may happen to add some
+ * entities to the idle tree. It happens if, in some
+ * of the calls to bfq_bfqq_move() performed by
+ * bfq_reparent_active_queues(), the queue to move is
+ * empty and gets expired.
+ */
+ bfq_flush_idle_tree(st);
}
__bfq_deactivate_entity(entity, false);