Skip to content

Commit

Permalink
blk-cgroup: Remove unnecessary rcu_read_lock/unlock()
Browse files Browse the repository at this point in the history
spin_lock_irq/spin_unlock_irq contains preempt_disable/enable().
Which can serve as RCU read-side critical region, so remove
rcu_read_lock/unlock().

Signed-off-by: Fanjun Kong <[email protected]>
Reviewed-by: Muchun Song <[email protected]>
Acked-by: Tejun Heo <[email protected]>
Link: https://lore.kernel.org/r/[email protected]
Signed-off-by: Jens Axboe <[email protected]>
  • Loading branch information
BH1SCW authored and axboe committed May 17, 2022
1 parent 3607849 commit 77c570a
Showing 1 changed file with 1 addition and 3 deletions.
4 changes: 1 addition & 3 deletions block/blk-cgroup.c
Original file line number Diff line number Diff line change
Expand Up @@ -1278,14 +1278,13 @@ int blkcg_init_queue(struct request_queue *q)
preloaded = !radix_tree_preload(GFP_KERNEL);

/* Make sure the root blkg exists. */
rcu_read_lock();
/* spin_lock_irq can serve as RCU read-side critical section. */
spin_lock_irq(&q->queue_lock);
blkg = blkg_create(&blkcg_root, q, new_blkg);
if (IS_ERR(blkg))
goto err_unlock;
q->root_blkg = blkg;
spin_unlock_irq(&q->queue_lock);
rcu_read_unlock();

if (preloaded)
radix_tree_preload_end();
Expand All @@ -1311,7 +1310,6 @@ int blkcg_init_queue(struct request_queue *q)
return ret;
err_unlock:
spin_unlock_irq(&q->queue_lock);
rcu_read_unlock();
if (preloaded)
radix_tree_preload_end();
return PTR_ERR(blkg);
Expand Down

0 comments on commit 77c570a

Please sign in to comment.