]> asedeno.scripts.mit.edu Git - linux.git/commitdiff
blkcg, writeback: Add wbc->no_cgroup_owner
authorTejun Heo <tj@kernel.org>
Thu, 27 Jun 2019 20:39:50 +0000 (13:39 -0700)
committerJens Axboe <axboe@kernel.dk>
Wed, 10 Jul 2019 15:00:57 +0000 (09:00 -0600)
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>
fs/fs-writeback.c
include/linux/writeback.h

index 0aef79e934bbc7ce3171d5ac9f5966d567b6918d..542b02d170f8bb99408aa7537bde91c10f977099 100644 (file)
@@ -727,7 +727,7 @@ void wbc_account_cgroup_owner(struct writeback_control *wbc, struct page *page,
         * behind a slow cgroup.  Ultimately, we want pageout() to kick off
         * regular writeback instead of writing things out itself.
         */
-       if (!wbc->wb)
+       if (!wbc->wb || wbc->no_cgroup_owner)
                return;
 
        css = mem_cgroup_css_from_page(page);
index dda5cf2281722e250e0f6123411874c029d21fb5..33a50fa09facdf74a67e8454798df41900e29e5b 100644 (file)
@@ -68,6 +68,15 @@ struct writeback_control {
        unsigned for_reclaim:1;         /* Invoked from the page allocator */
        unsigned range_cyclic:1;        /* range_start is cyclic */
        unsigned for_sync:1;            /* sync(2) WB_SYNC_ALL writeback */
+
+       /*
+        * When writeback IOs are bounced through async layers, only the
+        * initial synchronous phase should be accounted towards inode
+        * cgroup ownership arbitration to avoid confusion.  Later stages
+        * can set the following flag to disable the accounting.
+        */
+       unsigned no_cgroup_owner:1;
+
 #ifdef CONFIG_CGROUP_WRITEBACK
        struct bdi_writeback *wb;       /* wb this writeback is issued under */
        struct inode *inode;            /* inode being written out */