aboutsummaryrefslogtreecommitdiffstats
path: root/include
diff options
context:
space:
mode:
authorShaohua Li <shli@fb.com>2017-07-12 11:49:54 -0700
committerJens Axboe <axboe@kernel.dk>2017-07-29 09:00:03 -0600
commit007cc56b7eeca8848021bc43aca2b8607fbe5589 (patch)
treed178bdf4a51e3a0b6b4b72341dd10b9aa3d299c4 /include
parentblktrace: export cgroup info in trace (diff)
downloadlinux-dev-007cc56b7eeca8848021bc43aca2b8607fbe5589.tar.xz
linux-dev-007cc56b7eeca8848021bc43aca2b8607fbe5589.zip
block: always attach cgroup info into bio
blkcg_bio_issue_check() already gets blkcg for a BIO. bio_associate_blkcg() uses a percpu refcounter, so it's a very cheap operation. There is no point we don't attach the cgroup info into bio at blkcg_bio_issue_check. This also makes blktrace outputs correct cgroup info. Acked-by: Tejun Heo <tj@kernel.org> Signed-off-by: Shaohua Li <shli@fb.com> Signed-off-by: Jens Axboe <axboe@kernel.dk>
Diffstat (limited to 'include')
-rw-r--r--include/linux/blk-cgroup.h3
1 files changed, 3 insertions, 0 deletions
diff --git a/include/linux/blk-cgroup.h b/include/linux/blk-cgroup.h
index 7104bea8dab1..9d92153dd856 100644
--- a/include/linux/blk-cgroup.h
+++ b/include/linux/blk-cgroup.h
@@ -691,6 +691,9 @@ static inline bool blkcg_bio_issue_check(struct request_queue *q,
rcu_read_lock();
blkcg = bio_blkcg(bio);
+ /* associate blkcg if bio hasn't attached one */
+ bio_associate_blkcg(bio, &blkcg->css);
+
blkg = blkg_lookup(blkcg, q);
if (unlikely(!blkg)) {
spin_lock_irq(q->queue_lock);