linux-mm.kvack.org archive mirror
 help / color / mirror / Atom feed
From: "Rafael J. Wysocki" <rafael@kernel.org>
To: Andrea Righi <andrea.righi@canonical.com>
Cc: Luigi Semenzato <semenzato@google.com>,
	Pavel Machek <pavel@ucw.cz>,
	 linux-kernel <linux-kernel@vger.kernel.org>,
	 Linux Memory Management List <linux-mm@kvack.org>,
	Linux PM <linux-pm@vger.kernel.org>,
	 Andrew Morton <akpm@linux-foundation.org>,
	Len Brown <len.brown@intel.com>,
	 "Rafael J . Wysocki" <rjw@rjwysocki.net>
Subject: Re: [RFC PATCH 2/2] PM: hibernate: introduce opportunistic memory reclaim
Date: Mon, 21 Sep 2020 17:36:30 +0200	[thread overview]
Message-ID: <CAJZ5v0jWvQssoajoz2qh3Rbw8gNJSnRxg3NW6R6ayXYeHxodOQ@mail.gmail.com> (raw)
In-Reply-To: <20200609061931.GH8413@xps-13>

Hi Andrea,

On Tue, Jun 9, 2020 at 8:19 AM Andrea Righi <andrea.righi@canonical.com> wrote:
>
> On Mon, Jun 08, 2020 at 03:23:22PM -0700, Luigi Semenzato wrote:
> > Hi Andrea,
> >
> > 1. This mechanism is quite general.  It is possible that, although
> > hibernation may be an important use, there will be other uses for it.
> > I suggest leaving the hibernation example and performance analysis,
> > but not mentioning PM or hibernation in the patch subject.
>
> I was actually thinking to make this feature even more generic, since
> there might be other potential users of this forced "memory reclaim"
> feature outside hibernation. So, instead of adding the new sysfs files
> under /sys/power/mm_reclaim/, maybe move them to /sys/kernel/mm/ (since
> it's more like a mm feature, rather than a PM/hibernation feature).
>
> >
> > 2. It may be useful to have run_show() return the number of pages
> > reclaimed in the last attempt.  (I had suggested something similar in
> > https://lore.kernel.org/linux-mm/CAA25o9SxajRaa+ZyhvTYdaKdXokcrNYXgEUimax4sUJGCmRYLA@mail.gmail.com/).
>
> I like this idea, I'll add that in the next version.
>
> >
> > 3. It is not clear how much mm_reclaim/release is going to help.  If
> > the preloading of the swapped-out pages uses some kind of LIFO order,
> > and can batch multiple pages, then it might help.  Otherwise demand
> > paging is likely to be more effective.  If the preloading does indeed
> > help, it may be useful to explain why in the commit message.
>
> Swap readahead helps a lot in terms of performance if we preload all at
> once. But I agree that for the majority of cases on-demand paging just
> works fine.
>
> My specific use-case for mm_reclaim/release is to make sure a VM
> that is just resumed is immediately "fast" by preloading the swapped-out
> pages back to memory all at once.
>
> Without mm_reclaim/release I've been using the trick of running swapoff
> followed by a swapon to force all the pages back to memory, but it's
> kinda ugly and I was looking for a better way to do this. I've been
> trying also the ptrace() + reading all the VMAs via /proc/pid/mem, it
> works, but it's not as fast as swapoff+swapon or mm_reclaim/release.
>
> I'll report performance numbers of mm_reclaim/release vs ptrace() +
> /proc/pid/mem in the next version of this patch.

Sorry for the huge delay.

I'm wondering what your vision regarding the use of this mechanism in
practice is?

In the "Testing" part of the changelog you say that "in the
5.7-mm_reclaim case a user-space daemon detects when the system is
idle and triggers the opportunistic memory reclaim via
/sys/power/mm_reclaim/run", but this may not be entirely practical,
because hibernation is not triggered every time the system is idle.

In particular, how much time is required for the opportunistic reclaim
to run before hibernation so as to make a significant difference?

Thanks!


  reply	other threads:[~2020-09-21 15:36 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2020-06-08 22:23 [RFC PATCH 2/2] PM: hibernate: introduce opportunistic memory reclaim Luigi Semenzato
2020-06-09  6:19 ` Andrea Righi
2020-09-21 15:36   ` Rafael J. Wysocki [this message]
2020-09-21 16:27     ` Andrea Righi
  -- strict thread matches above, loose matches on Subject: below --
2020-06-01 16:06 [RFC PATCH 0/2] PM: hibernate: " Andrea Righi
2020-06-01 16:06 ` [RFC PATCH 2/2] PM: hibernate: introduce " Andrea Righi

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=CAJZ5v0jWvQssoajoz2qh3Rbw8gNJSnRxg3NW6R6ayXYeHxodOQ@mail.gmail.com \
    --to=rafael@kernel.org \
    --cc=akpm@linux-foundation.org \
    --cc=andrea.righi@canonical.com \
    --cc=len.brown@intel.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-mm@kvack.org \
    --cc=linux-pm@vger.kernel.org \
    --cc=pavel@ucw.cz \
    --cc=rjw@rjwysocki.net \
    --cc=semenzato@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;
as well as URLs for NNTP newsgroup(s).