diff options
Diffstat (limited to 'block/blk-throttle.c')
-rw-r--r-- | block/blk-throttle.c | 22 |
1 files changed, 21 insertions, 1 deletions
diff --git a/block/blk-throttle.c b/block/blk-throttle.c index 27f006bb363b..08a32dfd3844 100644 --- a/block/blk-throttle.c +++ b/block/blk-throttle.c | |||
@@ -397,10 +397,30 @@ static void throtl_pd_init(struct blkcg_gq *blkg) | |||
397 | { | 397 | { |
398 | struct throtl_grp *tg = blkg_to_tg(blkg); | 398 | struct throtl_grp *tg = blkg_to_tg(blkg); |
399 | struct throtl_data *td = blkg->q->td; | 399 | struct throtl_data *td = blkg->q->td; |
400 | struct throtl_service_queue *parent_sq; | ||
400 | unsigned long flags; | 401 | unsigned long flags; |
401 | int rw; | 402 | int rw; |
402 | 403 | ||
403 | throtl_service_queue_init(&tg->service_queue, &td->service_queue); | 404 | /* |
405 | * If sane_hierarchy is enabled, we switch to properly hierarchical | ||
406 | * behavior where limits on a given throtl_grp are applied to the | ||
407 | * whole subtree rather than just the group itself. e.g. If 16M | ||
408 | * read_bps limit is set on the root group, the whole system can't | ||
409 | * exceed 16M for the device. | ||
410 | * | ||
411 | * If sane_hierarchy is not enabled, the broken flat hierarchy | ||
412 | * behavior is retained where all throtl_grps are treated as if | ||
413 | * they're all separate root groups right below throtl_data. | ||
414 | * Limits of a group don't interact with limits of other groups | ||
415 | * regardless of the position of the group in the hierarchy. | ||
416 | */ | ||
417 | parent_sq = &td->service_queue; | ||
418 | |||
419 | if (cgroup_sane_behavior(blkg->blkcg->css.cgroup) && blkg->parent) | ||
420 | parent_sq = &blkg_to_tg(blkg->parent)->service_queue; | ||
421 | |||
422 | throtl_service_queue_init(&tg->service_queue, parent_sq); | ||
423 | |||
404 | for (rw = READ; rw <= WRITE; rw++) { | 424 | for (rw = READ; rw <= WRITE; rw++) { |
405 | throtl_qnode_init(&tg->qnode_on_self[rw], tg); | 425 | throtl_qnode_init(&tg->qnode_on_self[rw], tg); |
406 | throtl_qnode_init(&tg->qnode_on_parent[rw], tg); | 426 | throtl_qnode_init(&tg->qnode_on_parent[rw], tg); |