diff options
author | Jiang Biao <jiang.biao2@zte.com.cn> | 2018-04-18 10:37:18 -0400 |
---|---|---|
committer | Jens Axboe <axboe@kernel.dk> | 2018-04-18 10:37:18 -0400 |
commit | 946b81da114b8ba5c74bb01e57c0c6eca2bdc801 (patch) | |
tree | 5f4adb9a9a46eaee2c142dfc7f76d60abaea07da | |
parent | 0ce9144471de9ee09306ca0127e7cd27521ccc3f (diff) |
blkcg: don't hold blkcg lock when deactivating policy
As described in the comment of blkcg_activate_policy(),
*Update of each blkg is protected by both queue and blkcg locks so
that holding either lock and testing blkcg_policy_enabled() is
always enough for dereferencing policy data.*
with queue lock held, there is no need to hold blkcg lock in
blkcg_deactivate_policy(). Similar case is in
blkcg_activate_policy(), which has removed holding of blkcg lock in
commit 4c55f4f9ad3001ac1fefdd8d8ca7641d18558e23.
Signed-off-by: Jiang Biao <jiang.biao2@zte.com.cn>
Signed-off-by: Wen Yang <wen.yang99@zte.com.cn>
CC: Tejun Heo <tj@kernel.org>
Signed-off-by: Jens Axboe <axboe@kernel.dk>
-rw-r--r-- | block/blk-cgroup.c | 5 |
1 files changed, 0 insertions, 5 deletions
diff --git a/block/blk-cgroup.c b/block/blk-cgroup.c index 1c16694ae145..21bc449d01c0 100644 --- a/block/blk-cgroup.c +++ b/block/blk-cgroup.c | |||
@@ -1410,9 +1410,6 @@ void blkcg_deactivate_policy(struct request_queue *q, | |||
1410 | __clear_bit(pol->plid, q->blkcg_pols); | 1410 | __clear_bit(pol->plid, q->blkcg_pols); |
1411 | 1411 | ||
1412 | list_for_each_entry(blkg, &q->blkg_list, q_node) { | 1412 | list_for_each_entry(blkg, &q->blkg_list, q_node) { |
1413 | /* grab blkcg lock too while removing @pd from @blkg */ | ||
1414 | spin_lock(&blkg->blkcg->lock); | ||
1415 | |||
1416 | if (blkg->pd[pol->plid]) { | 1413 | if (blkg->pd[pol->plid]) { |
1417 | if (!blkg->pd[pol->plid]->offline && | 1414 | if (!blkg->pd[pol->plid]->offline && |
1418 | pol->pd_offline_fn) { | 1415 | pol->pd_offline_fn) { |
@@ -1422,8 +1419,6 @@ void blkcg_deactivate_policy(struct request_queue *q, | |||
1422 | pol->pd_free_fn(blkg->pd[pol->plid]); | 1419 | pol->pd_free_fn(blkg->pd[pol->plid]); |
1423 | blkg->pd[pol->plid] = NULL; | 1420 | blkg->pd[pol->plid] = NULL; |
1424 | } | 1421 | } |
1425 | |||
1426 | spin_unlock(&blkg->blkcg->lock); | ||
1427 | } | 1422 | } |
1428 | 1423 | ||
1429 | spin_unlock_irq(q->queue_lock); | 1424 | spin_unlock_irq(q->queue_lock); |