All of lore.kernel.org
 help / color / mirror / Atom feed
From: Tejun Heo <tj@kernel.org>
To: Dave Chinner <david@fromorbit.com>
Cc: tytso@mit.edu, adilger.kernel@dilger.ca,
	linux-kernel@vger.kernel.org, linux-fsdevel@vger.kernel.org,
	lizefan@huawei.com, cgroups@vger.kernel.org, hannes@cmpxchg.org,
	kernel-team@fb.com, linux-ext4@vger.kernel.org, axboe@kernel.dk
Subject: Re: [PATCHSET v2 block/for-4.2/writeback] ext4: implement cgroup writeback support
Date: Thu, 16 Jul 2015 19:37:11 -0400	[thread overview]
Message-ID: <20150716233711.GA15934@mtj.duckdns.org> (raw)
In-Reply-To: <20150716232159.GN7943@dastard>

Hello, Dave.

On Fri, Jul 17, 2015 at 09:21:59AM +1000, Dave Chinner wrote:
> Tejun, is this all that needs to be done to support cgroup aware
> writeback in a filesystem (i.e. wbc_init_bio, wbc_account_io in the
> writepage path, superblock flag)?

Yes, this is about it.  It gets slightly more complex if bio's are
bounced to another task as they would need to be associated with the
current cgroup.

The following is from Documentation/cgroups/blkio-controller.txt

Filesystem support for cgroup writeback
---------------------------------------

A filesystem can make writeback IOs cgroup-aware by updating
address_space_operations->writepage[s]() to annotate bio's using the
following two functions.

* wbc_init_bio(@wbc, @bio)

  Should be called for each bio carrying writeback data and associates
  the bio with the inode's owner cgroup.  Can be called anytime
  between bio allocation and submission.

* wbc_account_io(@wbc, @page, @bytes)

  Should be called for each data segment being written out.  While
  this function doesn't care exactly when it's called during the
  writeback session, it's the easiest and most natural to call it as
  data segments are added to a bio.

With writeback bio's annotated, cgroup support can be enabled per
super_block by setting MS_CGROUPWB in ->s_flags.  This allows for
selective disabling of cgroup writeback support which is helpful when
certain filesystem features, e.g. journaled data mode, are
incompatible.

wbc_init_bio() binds the specified bio to its cgroup.  Depending on
the configuration, the bio may be executed at a lower priority and if
the writeback session is holding shared resources, e.g. a journal
entry, may lead to priority inversion.  There is no one easy solution
for the problem.  Filesystems can try to work around specific problem
cases by skipping wbc_init_bio() or using bio_associate_blkcg()
directly.

Thanks.

-- 
tejun

  reply	other threads:[~2015-07-16 23:37 UTC|newest]

Thread overview: 58+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2015-06-16 22:53 [PATCHSET v2 block/for-4.2/writeback] ext4: implement cgroup writeback support Tejun Heo
2015-06-16 22:53 ` Tejun Heo
2015-06-16 22:53 ` [PATCH 1/2] ext4: replace ext4_io_submit->io_op with ->io_wbc Tejun Heo
2015-07-22  3:56   ` Theodore Ts'o
2015-07-22  3:56     ` Theodore Ts'o
2015-06-16 22:53 ` [PATCH 2/2] ext4: implement cgroup writeback support Tejun Heo
2015-07-22  3:56   ` Theodore Ts'o
2015-07-22  3:56     ` Theodore Ts'o
2015-09-23 12:49     ` Artem Bityutskiy
2015-09-23 13:50       ` Artem Bityutskiy
2015-09-23 17:02         ` Theodore Ts'o
2015-09-23 17:57           ` Tejun Heo
2015-09-23 17:25       ` Chris Mason
2015-09-23 17:25         ` Chris Mason
     [not found]         ` <CAF4G-tKEcnVw76-ZU77AjmBDGybLnNEOKjkJtYBN67es0wb30g@mail.gmail.com>
2015-09-23 17:53           ` Chris Mason
2015-09-23 17:53             ` Chris Mason
2015-09-23 18:24             ` Theodore Ts'o
     [not found]               ` <CAF4G-t+E89a_A3RzQYB9wXxqE6nM0t7wN6fNmLABZ70=ivHTRQ@mail.gmail.com>
2015-09-23 19:47                 ` Artem Bityutskiy
2015-09-23 19:47                   ` Artem Bityutskiy
2015-09-23 20:48                   ` Theodore Ts'o
2015-09-24  8:13                     ` Artem Bityutskiy
2015-09-23 19:03           ` Tejun Heo
2015-09-23 19:03             ` Tejun Heo
2015-09-23 18:09       ` Tejun Heo
2015-09-23 18:09         ` Tejun Heo
2015-09-23 18:51         ` Tejun Heo
2015-09-23 18:51           ` Tejun Heo
2015-09-23 21:07           ` [PATCH cgroup/for-4.3-fixes] cgroup, writeback: don't enable cgroup writeback on traditional hierarchies Tejun Heo
2015-09-24  8:09             ` Artem Bityutskiy
2015-09-24  8:40               ` Dexuan Cui
2015-09-24  8:40                 ` Dexuan Cui
2015-09-24 20:47                 ` Tejun Heo
2015-09-24 20:47                   ` Tejun Heo
2015-09-28 21:39                   ` Tejun Heo
2015-09-24 20:45               ` Tejun Heo
2015-09-24 20:45                 ` Tejun Heo
2015-09-25  6:49                 ` Artem Bityutskiy
2015-09-25  6:49                   ` Artem Bityutskiy
2015-09-25 10:50                   ` Artem Bityutskiy
2015-09-25 10:50                     ` Artem Bityutskiy
2015-09-25 15:49                     ` Tejun Heo
2015-09-26  8:06                       ` Artem Bityutskiy
2015-09-26 22:14                         ` Tejun Heo
2015-09-29 11:37                           ` Artem Bityutskiy
2015-09-29 11:37                             ` Artem Bityutskiy
2015-09-29 14:26                             ` Tejun Heo
2015-09-24 16:17             ` Jens Axboe
2015-09-24 16:17               ` Jens Axboe
2015-09-24 16:17               ` Jens Axboe
2015-09-24 20:48             ` Tejun Heo
2015-07-12 18:05 ` [PATCHSET v2 block/for-4.2/writeback] ext4: implement cgroup writeback support Tejun Heo
2015-07-16 19:40   ` Tejun Heo
2015-07-16 19:40     ` Tejun Heo
2015-07-16 23:21     ` Dave Chinner
2015-07-16 23:37       ` Tejun Heo [this message]
2015-07-17  1:37   ` Theodore Ts'o
2015-07-17  1:37     ` Theodore Ts'o
2015-07-17 15:20     ` Tejun Heo

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20150716233711.GA15934@mtj.duckdns.org \
    --to=tj@kernel.org \
    --cc=adilger.kernel@dilger.ca \
    --cc=axboe@kernel.dk \
    --cc=cgroups@vger.kernel.org \
    --cc=david@fromorbit.com \
    --cc=hannes@cmpxchg.org \
    --cc=kernel-team@fb.com \
    --cc=linux-ext4@vger.kernel.org \
    --cc=linux-fsdevel@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=lizefan@huawei.com \
    --cc=tytso@mit.edu \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.