From: Dan Schatzberg <schatzberg.dan@gmail.com>
To: Johannes Weiner <hannes@cmpxchg.org>
Cc: David Rientjes <rientjes@google.com>,
Andrew Morton <akpm@linux-foundation.org>,
Michal Hocko <mhocko@kernel.org>, Yu Zhao <yuzhao@google.com>,
Dave Hansen <dave.hansen@linux.intel.com>,
linux-mm@kvack.org, Yosry Ahmed <yosryahmed@google.com>,
Wei Xu <weixugc@google.com>, Shakeel Butt <shakeelb@google.com>,
Greg Thelen <gthelen@google.com>
Subject: Re: [RFC] Mechanism to induce memory reclaim
Date: Tue, 8 Mar 2022 17:37:00 -0500 [thread overview]
Message-ID: <YifajBXY160/6siq@dschatzberg-fedora-PC0Y6AEN.dhcp.thefacebook.com> (raw)
In-Reply-To: <YieuNVOUOgQulQyo@cmpxchg.org>
On Tue, Mar 08, 2022 at 02:27:49PM -0500, Johannes Weiner wrote:
> On Tue, Mar 08, 2022 at 09:49:20AM -0500, Dan Schatzberg wrote:
> > On Mon, Mar 07, 2022 at 03:50:36PM -0500, Johannes Weiner wrote:
> > > On Sun, Mar 06, 2022 at 03:11:23PM -0800, David Rientjes wrote:
> > > > - swappiness factor
> > >
> > > This I'm not sure about.
> > >
> > > Mostly because I'm not sure about swappiness in general. It balances
> > > between anon and file, but both of them are aged according to the same
> > > LRU rules. The only reason to prefer one over the other seems to be
> > > when the cost of reloading one (refault vs swapin) isn't the same as
> > > the other. That's usually a hardware property, which in a perfect
> > > world we'd auto-tune inside the kernel based on observed IO
> > > performance. Not sure why you'd want this per reclaim request.
> >
> > I think this could be useful for budgeting write-endurance. You may
> > want to tune down a workload's swappiness on a per-reclaim basis in
> > order to control how much swap-out (and therefore disk writes) its
> > doing. Right now the only way to control this is by writing to
> > vm.swappiness before doing the explicit reclaim which can momentarily
> > effect other reclaim behavior on the machine.
>
> Yeah the global swappiness setting is not ideal for tuning behavior of
> individual workloads. On the other hand, flash life and write budget
> are global resources shared by all workloads on the system. Does it
> make sense longer term to take a workload-centric approach to that?
Indeed flash life is a global resource, but it may be desireable to
budget it on a per-workload basis. Consider a workload with a lot of
warm anonymous memory - proactive reclaim of this workload may be able
to consume the entire write budget of the machine. This could result
in a co-located workload getting reduced reclaim due to insufficient
write budget. We'd like some form of isolation here so that the
co-located workload receives some fair-share of the write budget which
is hard to do without some additional control.
> There are also filesystem writes to think about. If the swappable set
> has already been swapped and cached, reclaiming it again doesn't
> require IO. Reclaiming dirty cache OTOH requires IO, and upping
> reclaim pressure on files will increase the writeback flush rates
> (which reduces cache effectiveness and increases aggregate writes).
>
> I wonder if it would make more sense to recognize the concept of write
> endurance more broadly in MM code than just swap. Where you specify a
> rate limit (globally? with per-cgroup shares?), and then, yes, the VM
> will back away from swap iff it writes too much. But also throttle
> writeback and push back on file reclaim and dirtying processes in
> accordance with that policy.
Absolutely, we should discuss details but broadly I agree with the idea that
there's more than just per-cgroup swappiness control as a way to gain
control over mm-induced write endurance consumption.
next prev parent reply other threads:[~2022-03-08 22:37 UTC|newest]
Thread overview: 24+ messages / expand[flat|nested] mbox.gz Atom feed top
2022-03-06 23:11 David Rientjes
2022-03-07 0:49 ` Yu Zhao
2022-03-07 14:41 ` Michal Hocko
2022-03-07 18:31 ` Shakeel Butt
2022-03-07 20:26 ` Johannes Weiner
2022-03-08 12:53 ` Michal Hocko
2022-03-08 14:44 ` Dan Schatzberg
2022-03-08 16:05 ` Michal Hocko
2022-03-08 17:21 ` Wei Xu
2022-03-08 17:23 ` Johannes Weiner
2022-03-08 12:52 ` Michal Hocko
2022-03-09 22:03 ` David Rientjes
2022-03-10 16:58 ` Johannes Weiner
2022-03-10 17:25 ` Shakeel Butt
2022-03-10 17:33 ` Wei Xu
2022-03-10 17:42 ` Johannes Weiner
2022-03-07 20:50 ` Johannes Weiner
2022-03-07 22:53 ` Wei Xu
2022-03-08 12:53 ` Michal Hocko
2022-03-08 14:49 ` Dan Schatzberg
2022-03-08 19:27 ` Johannes Weiner
2022-03-08 22:37 ` Dan Schatzberg [this message]
2022-03-09 22:30 ` David Rientjes
2022-03-10 16:10 ` Johannes Weiner
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=YifajBXY160/6siq@dschatzberg-fedora-PC0Y6AEN.dhcp.thefacebook.com \
--to=schatzberg.dan@gmail.com \
--cc=akpm@linux-foundation.org \
--cc=dave.hansen@linux.intel.com \
--cc=gthelen@google.com \
--cc=hannes@cmpxchg.org \
--cc=linux-mm@kvack.org \
--cc=mhocko@kernel.org \
--cc=rientjes@google.com \
--cc=shakeelb@google.com \
--cc=weixugc@google.com \
--cc=yosryahmed@google.com \
--cc=yuzhao@google.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