summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorTejun Heo <tj@kernel.org>2019-06-27 16:39:50 -0400
committerJens Axboe <axboe@kernel.dk>2019-07-10 11:00:57 -0400
commit27b36d8fa81fa8274fb72f4eb1484026f6b6daa8 (patch)
tree3880d0298b096462f409a526bfbd52f7ef7875a8
parent34e51a5e1a6e939ed7d99c38173821ab86d577f4 (diff)
blkcg, writeback: Add wbc->no_cgroup_owner
When writeback IOs are bounced through async layers, the IOs should only be accounted against the wbc from the original bdi writeback to avoid confusing cgroup inode ownership arbitration. Add wbc->no_cgroup_owner to allow disabling wbc cgroup owner accounting. This will be used make btrfs compression work well with cgroup IO control. v2: Renamed from no_wbc_acct to no_cgroup_owner and added comment as per Jan. 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>
-rw-r--r--fs/fs-writeback.c2
-rw-r--r--include/linux/writeback.h9
2 files changed, 10 insertions, 1 deletions
diff --git a/fs/fs-writeback.c b/fs/fs-writeback.c
index 0aef79e934bb..542b02d170f8 100644
--- a/fs/fs-writeback.c
+++ b/fs/fs-writeback.c
@@ -727,7 +727,7 @@ void wbc_account_cgroup_owner(struct writeback_control *wbc, struct page *page,
727 * behind a slow cgroup. Ultimately, we want pageout() to kick off 727 * behind a slow cgroup. Ultimately, we want pageout() to kick off
728 * regular writeback instead of writing things out itself. 728 * regular writeback instead of writing things out itself.
729 */ 729 */
730 if (!wbc->wb) 730 if (!wbc->wb || wbc->no_cgroup_owner)
731 return; 731 return;
732 732
733 css = mem_cgroup_css_from_page(page); 733 css = mem_cgroup_css_from_page(page);
diff --git a/include/linux/writeback.h b/include/linux/writeback.h
index dda5cf228172..33a50fa09fac 100644
--- a/include/linux/writeback.h
+++ b/include/linux/writeback.h
@@ -68,6 +68,15 @@ struct writeback_control {
68 unsigned for_reclaim:1; /* Invoked from the page allocator */ 68 unsigned for_reclaim:1; /* Invoked from the page allocator */
69 unsigned range_cyclic:1; /* range_start is cyclic */ 69 unsigned range_cyclic:1; /* range_start is cyclic */
70 unsigned for_sync:1; /* sync(2) WB_SYNC_ALL writeback */ 70 unsigned for_sync:1; /* sync(2) WB_SYNC_ALL writeback */
71
72 /*
73 * When writeback IOs are bounced through async layers, only the
74 * initial synchronous phase should be accounted towards inode
75 * cgroup ownership arbitration to avoid confusion. Later stages
76 * can set the following flag to disable the accounting.
77 */
78 unsigned no_cgroup_owner:1;
79
71#ifdef CONFIG_CGROUP_WRITEBACK 80#ifdef CONFIG_CGROUP_WRITEBACK
72 struct bdi_writeback *wb; /* wb this writeback is issued under */ 81 struct bdi_writeback *wb; /* wb this writeback is issued under */
73 struct inode *inode; /* inode being written out */ 82 struct inode *inode; /* inode being written out */