block: Skip destroyed blkg when restart in blkg_destroy_all()
Subsystems (2)
PATCH v2 1/1 block: Skip destroyed blkg when restart in blkg_destroy_all()
Kernel hang in blkg_destroy_all() when total blkg greater than BLKG_DESTROY_BATCH_SIZE, because of not removing destroyed blkg in blkg_list. So the size of blkg_list is same after destroying a batch of blkg, and the infinite 'restart' occurs.
Since blkg should stay on the queue list until blkg_free_workfn(), skip destroyed blkg when restart a new round, which will solve this kernel hang issue and satisfy the previous will to restart.
---
v2:
- change 'directly remove destroyed blkg' to 'skip destroyed blkg'
v1:
- https://lore.kernel.org/all/[email protected]/
block/blk-cgroup.c | 3 +++ 1 file changed, 3 insertions(+)
block/blk-cgroup.c +3 -0
@@ -528,6 +528,9 @@ static void blkg_destroy_all(struct gendisk *disk)list_for_each_entry_safe (blkg, n, &q->blkg_list, q_node) {struct blkcg *blkcg = blkg->blkcg; +if (hlist_unhashed (&blkg->blkcg_node)) +continue ; +spin_lock (&blkcg->lock);blkg_destroy (blkg);spin_unlock (&blkcg->lock);
Signature · 1 line
2.34.1
Hi,
Quoted 8 lines · Tao Su
Kernel hang in
blkg_destroy_all()when total blkg greater thanBLKG_DESTROY_BATCH_SIZE, because of not removing destroyed blkg inblkg_list. So the size ofblkg_listis same after destroying a batch of blkg, and the infinite 'restart' occurs.Since blkg should stay on the queue list until
blkg_free_workfn(), skip destroyed blkg when restart a new round, which will solve this kernel hang issue and satisfy the previous will to restart.
Please add a fix tag:
Quoted 5 lines
Reported-by Xiangfei Ma <[email protected]>Tested-by Xiangfei Ma <[email protected]>Tested-by Farrah Chen <[email protected]>Signed-off-by Yu Kuai <[email protected]>
You can remove this tag, and feel free to add:
Thanks,
Kuai
Quoted 26 lines
Signed-off-by Tao Su <[email protected]>---
v2:
- change 'directly remove destroyed blkg' to 'skip destroyed blkg'v1:
- https://lore.kernel.org/all/[email protected]/block/blk-cgroup.c | 3 +++ 1 file changed, 3 insertions(+)block/blk-cgroup.c +3
-0@@ -528,6 +528,9 @@ static void blkg_destroy_all(struct gendisk *disk)list_for_each_entry_safe (blkg, n, &q->blkg_list, q_node) {struct blkcg *blkcg = blkg->blkcg; +if (hlist_unhashed (&blkg->blkcg_node)) +continue ; +spin_lock (&blkcg->lock);blkg_destroy (blkg);spin_unlock (&blkcg->lock);
Quoted 17 lines · Yu Kuai
Hi,
Quoted 8 lines · Tao Su
Kernel hang in
blkg_destroy_all()when total blkg greater thanBLKG_DESTROY_BATCH_SIZE, because of not removing destroyed blkg inblkg_list. So the size ofblkg_listis same after destroying a batch of blkg, and the infinite 'restart' occurs.Since blkg should stay on the queue list until
blkg_free_workfn(), skip destroyed blkg when restart a new round, which will solve this kernel hang issue and satisfy the previous will to restart.Please add a fix tag:
Fixes f1c006f1c685 ("blk-cgroup: synchronize pd_free_fn() from
blkg_free_workfn()andblkcg_deactivate_policy()")Quoted 1 line
Quoted 8 lines
Quoted 4 lines
Reported-by Xiangfei Ma <[email protected]>Tested-by Xiangfei Ma <[email protected]>Tested-by Farrah Chen <[email protected]>Signed-off-by Yu Kuai <[email protected]>You can remove this tag, and feel free to add:
Suggested-and-reviewed-by Yu Kuai <[email protected]>
Got it, thanks!
Tao
Quoted 29 lines
Thanks,
KuaiQuoted 25 lines
Signed-off-by Tao Su <[email protected]>---
v2:
- change 'directly remove destroyed blkg' to 'skip destroyed blkg'v1:
- https://lore.kernel.org/all/[email protected]/block/blk-cgroup.c | 3 +++ 1 file changed, 3 insertions(+)block/blk-cgroup.c +3
-0@@ -528,6 +528,9 @@ static void blkg_destroy_all(struct gendisk *disk)list_for_each_entry_safe (blkg, n, &q->blkg_list, q_node) {struct blkcg *blkcg = blkg->blkcg; +if (hlist_unhashed (&blkg->blkcg_node)) +continue ; +spin_lock (&blkcg->lock);blkg_destroy (blkg);spin_unlock (&blkcg->lock);
Quoted 10 lines · Tao Su
Kernel hang in
blkg_destroy_all()when total blkg greater thanBLKG_DESTROY_BATCH_SIZE, because of not removing destroyed blkg inblkg_list. So the size ofblkg_listis same after destroying a batch of blkg, and the infinite 'restart' occurs.Since blkg should stay on the queue list until
blkg_free_workfn(), skip destroyed blkg when restart a new round, which will solve this kernel hang issue and satisfy the previous will to restart.[...]
Applied, thanks!
[1/1] block: Skip destroyed blkg when restart in blkg_destroy_all()
commit: 8176080d59e6d4ff9fc97ae534063073b4f7a715
Best regards,
Signature · 1 line
Jens Axboe
Quoted 7 lines · Jens Axboe
Quoted 5 lines · Tao Su
Kernel hang in
blkg_destroy_all()when total blkg greater thanBLKG_DESTROY_BATCH_SIZE, because of not removing destroyed blkg inblkg_list. So the size ofblkg_listis same after destroying a batch of blkg, and the infinite 'restart' occurs.
Quoted 7 lines
Quoted 5 lines
Since blkg should stay on the queue list until
blkg_free_workfn(), skip destroyed blkg when restart a new round, which will solve this kernel hang issue and satisfy the previous will to restart.[...]
Applied, thanks!
Axboe, thanks!
Tao
Quoted 10 lines
[1/1] block: Skip destroyed blkg when restart in
blkg_destroy_all()commit: 8176080d59e6d4ff9fc97ae534063073b4f7a715Best regards,
Signature · 1 line
Jens Axboe