Skip to content

Commit

Permalink
blk-cgroup: move rcu locking from blkcg_bio_issue_check to blk_throtl…
Browse files Browse the repository at this point in the history
…_bio

The only thing in blkcg_bio_issue_check that needs to be under
rcu_read_lock is blk_throtl_bio, so move the locking there.

Acked-by: Tejun Heo <tj@kernel.org>
Signed-off-by: Christoph Hellwig <hch@lst.de>
Signed-off-by: Jens Axboe <axboe@kernel.dk>
  • Loading branch information
Christoph Hellwig authored and Jens Axboe committed Jun 29, 2020
1 parent 7582f30 commit 93b8063
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 3 deletions.
3 changes: 2 additions & 1 deletion block/blk-throttle.c
Original file line number Diff line number Diff line change
Expand Up @@ -2168,7 +2168,7 @@ bool blk_throtl_bio(struct request_queue *q, struct blkcg_gq *blkg,
bool throttled = false;
struct throtl_data *td = tg->td;

WARN_ON_ONCE(!rcu_read_lock_held());
rcu_read_lock();

/* see throtl_charge_bio() */
if (bio_flagged(bio, BIO_THROTTLED))
Expand Down Expand Up @@ -2273,6 +2273,7 @@ bool blk_throtl_bio(struct request_queue *q, struct blkcg_gq *blkg,
if (throttled || !td->track_bio_latency)
bio->bi_issue.value |= BIO_ISSUE_THROTL_SKIP_LATENCY;
#endif
rcu_read_unlock();
return throttled;
}

Expand Down
2 changes: 0 additions & 2 deletions include/linux/blk-cgroup.h
Original file line number Diff line number Diff line change
Expand Up @@ -546,7 +546,6 @@ static inline bool blkcg_bio_issue_check(struct request_queue *q,
struct blkcg_gq *blkg = bio->bi_blkg;
bool throtl = false;

rcu_read_lock();
throtl = blk_throtl_bio(q, blkg, bio);
if (!throtl) {
struct blkg_iostat_set *bis;
Expand Down Expand Up @@ -582,7 +581,6 @@ static inline bool blkcg_bio_issue_check(struct request_queue *q,

blkcg_bio_issue_init(bio);

rcu_read_unlock();
return !throtl;
}

Expand Down

0 comments on commit 93b8063

Please sign in to comment.