Skip to content

Commit

Permalink
blkcg: don't hold blkcg lock when deactivating policy
Browse files Browse the repository at this point in the history
[ Upstream commit 946b81d ]

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 4c55f4f.

Signed-off-by: Jiang Biao <[email protected]>
Signed-off-by: Wen Yang <[email protected]>
CC: Tejun Heo <[email protected]>
Signed-off-by: Jens Axboe <[email protected]>
Signed-off-by: Sasha Levin <[email protected]>
Signed-off-by: Greg Kroah-Hartman <[email protected]>
  • Loading branch information
Jiang Biao authored and gregkh committed Jun 20, 2018
1 parent c5b6316 commit 9d5e2d6
Showing 1 changed file with 0 additions and 5 deletions.
5 changes: 0 additions & 5 deletions block/blk-cgroup.c
Original file line number Diff line number Diff line change
Expand Up @@ -1374,17 +1374,12 @@ void blkcg_deactivate_policy(struct request_queue *q,
__clear_bit(pol->plid, q->blkcg_pols);

list_for_each_entry(blkg, &q->blkg_list, q_node) {
/* grab blkcg lock too while removing @pd from @blkg */
spin_lock(&blkg->blkcg->lock);

if (blkg->pd[pol->plid]) {
if (pol->pd_offline_fn)
pol->pd_offline_fn(blkg->pd[pol->plid]);
pol->pd_free_fn(blkg->pd[pol->plid]);
blkg->pd[pol->plid] = NULL;
}

spin_unlock(&blkg->blkcg->lock);
}

spin_unlock_irq(q->queue_lock);
Expand Down

0 comments on commit 9d5e2d6

Please sign in to comment.