From: Tejun Heo <tj@kernel.org>
To: axboe@kernel.dk, jack@suse.cz, hannes@cmpxchg.org,
mhocko@kernel.org, vdavydov.dev@gmail.com
Cc: cgroups@vger.kernel.org, linux-mm@kvack.org,
linux-block@vger.kernel.org, linux-kernel@vger.kernel.org,
kernel-team@fb.com, guro@fb.com, akpm@linux-foundation.org
Subject: [PATCHSET v3] writeback, memcg: Implement foreign inode flushing
Date: Mon, 26 Aug 2019 09:06:51 -0700 [thread overview]
Message-ID: <20190826160656.870307-1-tj@kernel.org> (raw)
Hello,
Changes from v1[1]:
* More comments explaining the parameters.
* 0003-writeback-Separate-out-wb_get_lookup-from-wb_get_create.patch
added and avoid spuriously creating missing wbs for foreign
flushing.
Changes from v2[2]:
* Added livelock avoidance and applied other smaller changes suggested
by Jan.
There's an inherent mismatch between memcg and writeback. The former
trackes ownership per-page while the latter per-inode. This was a
deliberate design decision because honoring per-page ownership in the
writeback path is complicated, may lead to higher CPU and IO overheads
and deemed unnecessary given that write-sharing an inode across
different cgroups isn't a common use-case.
Combined with inode majority-writer ownership switching, this works
well enough in most cases but there are some pathological cases. For
example, let's say there are two cgroups A and B which keep writing to
different but confined parts of the same inode. B owns the inode and
A's memory is limited far below B's. A's dirty ratio can rise enough
to trigger balance_dirty_pages() sleeps but B's can be low enough to
avoid triggering background writeback. A will be slowed down without
a way to make writeback of the dirty pages happen.
This patchset implements foreign dirty recording and foreign mechanism
so that when a memcg encounters a condition as above it can trigger
flushes on bdi_writebacks which can clean its pages. Please see the
last patch for more details.
This patchset contains the following four patches.
0001-writeback-Generalize-and-expose-wb_completion.patch
0002-bdi-Add-bdi-id.patch
0003-writeback-Separate-out-wb_get_lookup-from-wb_get_create.patch
0004-writeback-memcg-Implement-cgroup_writeback_by_id.patch
0005-writeback-memcg-Implement-foreign-dirty-flushing.patch
0001-0004 are prep patches which expose wb_completion and implement
bdi->id and flushing by bdi and memcg IDs.
0005 implements foreign inode flushing.
Thanks. diffstat follows.
fs/fs-writeback.c | 130 ++++++++++++++++++++++++++++---------
include/linux/backing-dev-defs.h | 23 ++++++
include/linux/backing-dev.h | 5 +
include/linux/memcontrol.h | 39 +++++++++++
include/linux/writeback.h | 2
mm/backing-dev.c | 120 +++++++++++++++++++++++++++++-----
mm/memcontrol.c | 134 +++++++++++++++++++++++++++++++++++++++
mm/page-writeback.c | 4 +
8 files changed, 404 insertions(+), 53 deletions(-)
--
tejun
[1] http://lkml.kernel.org/r/20190803140155.181190-1-tj@kernel.org
[2] http://lkml.kenrel.org/r/20190815195619.GA2263813@devbig004.ftw2.facebook.com
next reply other threads:[~2019-08-26 16:07 UTC|newest]
Thread overview: 8+ messages / expand[flat|nested] mbox.gz Atom feed top
2019-08-26 16:06 Tejun Heo [this message]
2019-08-26 16:06 ` [PATCH 1/5] writeback: Generalize and expose wb_completion Tejun Heo
2019-08-26 16:06 ` [PATCH 2/5] bdi: Add bdi->id Tejun Heo
2019-08-26 16:06 ` [PATCH 3/5] writeback: Separate out wb_get_lookup() from wb_get_create() Tejun Heo
2019-08-26 16:06 ` [PATCH 4/5] writeback, memcg: Implement cgroup_writeback_by_id() Tejun Heo
2019-08-26 16:06 ` [PATCH 5/5] writeback, memcg: Implement foreign dirty flushing Tejun Heo
2019-08-27 14:47 ` Jan Kara
2019-08-27 15:23 ` [PATCHSET v3] writeback, memcg: Implement foreign inode flushing Jens Axboe
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=20190826160656.870307-1-tj@kernel.org \
--to=tj@kernel.org \
--cc=akpm@linux-foundation.org \
--cc=axboe@kernel.dk \
--cc=cgroups@vger.kernel.org \
--cc=guro@fb.com \
--cc=hannes@cmpxchg.org \
--cc=jack@suse.cz \
--cc=kernel-team@fb.com \
--cc=linux-block@vger.kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-mm@kvack.org \
--cc=mhocko@kernel.org \
--cc=vdavydov.dev@gmail.com \
/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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).