diff options
author | Josef Bacik <jbacik@fb.com> | 2018-07-03 11:14:51 -0400 |
---|---|---|
committer | Jens Axboe <axboe@kernel.dk> | 2018-07-09 09:07:53 -0600 |
commit | c7c98fd37653955d3a17dd4f1fa67aba070096a9 (patch) | |
tree | ab365652b13fbcd75c32267e377f41a42eef97d2 /include/linux/blk-cgroup.h | |
parent | 08e18eab0c579ad84399c1899c11899734854eb2 (diff) | |
download | lwn-c7c98fd37653955d3a17dd4f1fa67aba070096a9.tar.gz lwn-c7c98fd37653955d3a17dd4f1fa67aba070096a9.zip |
block: introduce bio_issue_as_root_blkg
Instead of forcing all file systems to get the right context on their
bio's, simply check for REQ_META to see if we need to issue as the root
blkg. We don't want to force all bio's to have the root blkg associated
with them if REQ_META is set, as some controllers (blk-iolatency) need
to know who the originating cgroup is so it can backcharge them for the
work they are doing. This helper will make sure that the controllers do
the proper thing wrt the IO priority and backcharging.
Signed-off-by: Josef Bacik <jbacik@fb.com>
Acked-by: Tejun Heo <tj@kernel.org>
Signed-off-by: Jens Axboe <axboe@kernel.dk>
Diffstat (limited to 'include/linux/blk-cgroup.h')
-rw-r--r-- | include/linux/blk-cgroup.h | 16 |
1 files changed, 16 insertions, 0 deletions
diff --git a/include/linux/blk-cgroup.h b/include/linux/blk-cgroup.h index 6c666fd7de3c..69aa71dc0c04 100644 --- a/include/linux/blk-cgroup.h +++ b/include/linux/blk-cgroup.h @@ -239,6 +239,22 @@ static inline struct blkcg *bio_blkcg(struct bio *bio) } /** + * bio_issue_as_root_blkg - see if this bio needs to be issued as root blkg + * @return: true if this bio needs to be submitted with the root blkg context. + * + * In order to avoid priority inversions we sometimes need to issue a bio as if + * it were attached to the root blkg, and then backcharge to the actual owning + * blkg. The idea is we do bio_blkcg() to look up the actual context for the + * bio and attach the appropriate blkg to the bio. Then we call this helper and + * if it is true run with the root blkg for that queue and then do any + * backcharging to the originating cgroup once the io is complete. + */ +static inline bool bio_issue_as_root_blkg(struct bio *bio) +{ + return (bio->bi_opf & REQ_META); +} + +/** * blkcg_parent - get the parent of a blkcg * @blkcg: blkcg of interest * |