aboutsummaryrefslogtreecommitdiffstats
path: root/include/linux/writeback.h
diff options
context:
space:
mode:
authorTejun Heo <tj@kernel.org>2019-06-27 16:39:52 -0400
committerJens Axboe <axboe@kernel.dk>2019-07-10 11:00:57 -0400
commitd3f77dfdc71835f8db71ca57d272b1fbec9dfc18 (patch)
treeced59cee416b39c3c2f80c647c736a2d378772e3 /include/linux/writeback.h
parent653c45c6b90c9659facbef10546d1f3a8e37d0cf (diff)
blkcg: implement REQ_CGROUP_PUNT
When a shared kthread needs to issue a bio for a cgroup, doing so synchronously can lead to priority inversions as the kthread can be trapped waiting for that cgroup. This patch implements REQ_CGROUP_PUNT flag which makes submit_bio() punt the actual issuing to a dedicated per-blkcg work item to avoid such priority inversions. This will be used to fix priority inversions in btrfs compression and should be generally useful as we grow filesystem support for comprehensive IO control. Cc: Chris Mason <clm@fb.com> Reviewed-by: Josef Bacik <josef@toxicpanda.com> Reviewed-by: Jan Kara <jack@suse.cz> Signed-off-by: Tejun Heo <tj@kernel.org> Signed-off-by: Jens Axboe <axboe@kernel.dk>
Diffstat (limited to 'include/linux/writeback.h')
-rw-r--r--include/linux/writeback.h13
1 files changed, 10 insertions, 3 deletions
diff --git a/include/linux/writeback.h b/include/linux/writeback.h
index e056a22075cf..8945aac31392 100644
--- a/include/linux/writeback.h
+++ b/include/linux/writeback.h
@@ -78,6 +78,8 @@ struct writeback_control {
78 */ 78 */
79 unsigned no_cgroup_owner:1; 79 unsigned no_cgroup_owner:1;
80 80
81 unsigned punt_to_cgroup:1; /* cgrp punting, see __REQ_CGROUP_PUNT */
82
81#ifdef CONFIG_CGROUP_WRITEBACK 83#ifdef CONFIG_CGROUP_WRITEBACK
82 struct bdi_writeback *wb; /* wb this writeback is issued under */ 84 struct bdi_writeback *wb; /* wb this writeback is issued under */
83 struct inode *inode; /* inode being written out */ 85 struct inode *inode; /* inode being written out */
@@ -94,12 +96,17 @@ struct writeback_control {
94 96
95static inline int wbc_to_write_flags(struct writeback_control *wbc) 97static inline int wbc_to_write_flags(struct writeback_control *wbc)
96{ 98{
99 int flags = 0;
100
101 if (wbc->punt_to_cgroup)
102 flags = REQ_CGROUP_PUNT;
103
97 if (wbc->sync_mode == WB_SYNC_ALL) 104 if (wbc->sync_mode == WB_SYNC_ALL)
98 return REQ_SYNC; 105 flags |= REQ_SYNC;
99 else if (wbc->for_kupdate || wbc->for_background) 106 else if (wbc->for_kupdate || wbc->for_background)
100 return REQ_BACKGROUND; 107 flags |= REQ_BACKGROUND;
101 108
102 return 0; 109 return flags;
103} 110}
104 111
105static inline struct cgroup_subsys_state * 112static inline struct cgroup_subsys_state *