Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > linux.kernel > #1685973

[PATCH V5 09/11] block: always attach cgroup info into bio

From Shaohua Li <shli@kernel.org>
Newsgroups linux.kernel
Subject [PATCH V5 09/11] block: always attach cgroup info into bio
Date 2017-07-12 21:00 +0200
Message-ID <u2v1E-3rs-23@gated-at.bofh.it> (permalink)
References <u2v1D-3rs-1@gated-at.bofh.it>
Organization linux.* mail to news gateway

Show all headers | View raw


From: Shaohua Li <shli@fb.com>

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>
---
 block/blk-throttle.c       | 7 +------
 include/linux/blk-cgroup.h | 3 +++
 2 files changed, 4 insertions(+), 6 deletions(-)

diff --git a/block/blk-throttle.c b/block/blk-throttle.c
index a7285bf..a6ebd2b 100644
--- a/block/blk-throttle.c
+++ b/block/blk-throttle.c
@@ -2104,14 +2104,9 @@ static inline void throtl_update_latency_buckets(struct throtl_data *td)
 static void blk_throtl_assoc_bio(struct throtl_grp *tg, struct bio *bio)
 {
 #ifdef CONFIG_BLK_DEV_THROTTLING_LOW
-	int ret;
-
-	ret = bio_associate_current(bio);
-	if (ret == 0 || ret == -EBUSY)
+	if (bio->bi_css)
 		bio->bi_cg_private = tg;
 	blk_stat_set_issue(&bio->bi_issue_stat, bio_sectors(bio));
-#else
-	bio_associate_current(bio);
 #endif
 }
 
diff --git a/include/linux/blk-cgroup.h b/include/linux/blk-cgroup.h
index 7104bea..9d92153 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);
-- 
2.9.3

Back to linux.kernel | Previous | NextPrevious in thread | Next in thread | Find similar | Unroll thread


Thread

[PATCH V5 00/11] blktrace: output cgroup info Shaohua Li <shli@kernel.org> - 2017-07-12 21:00 +0200
  [PATCH V5 11/11] block: use standard blktrace API to output cgroup info for debug notes Shaohua Li <shli@kernel.org> - 2017-07-12 21:00 +0200
  [PATCH V5 07/11] cgroup: export fhandle info for a cgroup Shaohua Li <shli@kernel.org> - 2017-07-12 21:00 +0200
  [PATCH V5 10/11] blktrace: add an option to allow displaying cgroup path Shaohua Li <shli@kernel.org> - 2017-07-12 21:00 +0200
  [PATCH V5 08/11] blktrace: export cgroup info in trace Shaohua Li <shli@kernel.org> - 2017-07-12 21:00 +0200
  [PATCH V5 02/11] kernfs: implement i_generation Shaohua Li <shli@kernel.org> - 2017-07-12 21:00 +0200
  [PATCH V5 06/11] kernfs: add exportfs operations Shaohua Li <shli@kernel.org> - 2017-07-12 21:00 +0200
  [PATCH V5 09/11] block: always attach cgroup info into bio Shaohua Li <shli@kernel.org> - 2017-07-12 21:00 +0200
  [PATCH V5 05/11] kernfs: introduce kernfs_node_id Shaohua Li <shli@kernel.org> - 2017-07-12 21:00 +0200
  [PATCH V5 04/11] kernfs: don't set dentry->d_fsdata Shaohua Li <shli@kernel.org> - 2017-07-12 21:00 +0200
  [PATCH V5 03/11] kernfs: add an API to get kernfs node from inode number Shaohua Li <shli@kernel.org> - 2017-07-12 21:00 +0200
  [PATCH V5 01/11] kernfs: use idr instead of ida to manage inode number Shaohua Li <shli@kernel.org> - 2017-07-12 21:00 +0200
  Re: [PATCH V5 00/11] blktrace: output cgroup info Jens Axboe <axboe@kernel.dk> - 2017-07-13 01:00 +0200

csiph-web