linux-mm.kvack.org archive mirror
 help / color / mirror / Atom feed
From: Johannes Weiner <hannes@cmpxchg.org>
To: Barry Song <21cnbao@gmail.com>
Cc: David Hildenbrand <david@redhat.com>,
	akpm@linux-foundation.org, linux-mm@kvack.org,
	linux-kernel@vger.kernel.org, Barry Song <v-songbaohua@oppo.com>,
	Baolin Wang <baolin.wang@linux.alibaba.com>,
	Matthew Wilcox <willy@infradead.org>,
	Oscar Salvador <osalvador@suse.de>,
	Ryan Roberts <ryan.roberts@arm.com>, Zi Yan <ziy@nvidia.com>
Subject: Re: [RFC PATCH] mm: don't promote exclusive file folios of dying processes
Date: Wed, 16 Apr 2025 19:58:49 -0400	[thread overview]
Message-ID: <20250416235849.GA780688@cmpxchg.org> (raw)
In-Reply-To: <CAGsJ_4zt2Yuornri1bO=3o7myey1Q2dmvtjn2baD0ahxOyoNjw@mail.gmail.com>

On Thu, Apr 17, 2025 at 05:54:57AM +0800, Barry Song wrote:
> On Thu, Apr 17, 2025 at 2:18 AM Johannes Weiner <hannes@cmpxchg.org> wrote:
> > Right, I'm more broadly objecting to the patch and its premise, but
> > thought the exclusive filtering would at least mitigate its downsides
> > somewhat. You raise good points that it's not as clear cut.
> >
> > IMO this is too subtle and unpredictable for everybody else. The
> > kernel can't see the future, but access locality and recent use is a
> > proven predictor. We generally don't discard access information,
> > unless the user asks us to, and that's what the madvise calls are for.
> 
> David pointed out some exceptions - the recency of dying processes might
> still be useful to new processes, particularly in cases like:
> 
>   while true; do app; done
> 
> Here, 'app' is repeatedly restarted but always maintains a single running
> instance. I agree this seems correct.
> 
> However, we can also find many cases where a dying process means its folios
> instantly become cold. For example:

Of course, there are many of them. Just like any access could be the
last one to that page for the next hour. But you don't know which ones
they are. Just like you don't know if I'm shutting down firefox
because that's enough internet for one day, or if I'm just restarting
it to clear out the 107 tabs I've lost track off.

> I agree that "access locality and recent use" is generally a good heuristic,
> but it must have some correlation (strong or weak) with the process lifecycle.

I don't agree. It's a cache shared between past, present and future
processes. The lifecycle of an individual processes is not saying much.

Unless you know something about userspace, and the exact data at hand,
that the kernel doesn't, which is why the Android usecase of MADV_COLD
or PAGEOUT for background apps makes sense to me, but generally tying
it to a process death does not.


  reply	other threads:[~2025-04-16 23:58 UTC|newest]

Thread overview: 19+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2025-04-12  8:58 [RFC PATCH] mm: don't promote exclusive file folios of dying processes Barry Song
2025-04-12 15:48 ` Matthew Wilcox
2025-04-12 16:31 ` Zi Yan
2025-04-16  7:48   ` Barry Song
2025-04-16  8:24     ` Baolin Wang
2025-04-16  8:32 ` David Hildenbrand
2025-04-16  9:24   ` Barry Song
2025-04-16  9:32     ` David Hildenbrand
2025-04-16  9:38       ` Barry Song
2025-04-16  9:40         ` David Hildenbrand
2025-04-16 14:15           ` Johannes Weiner
2025-04-16 15:59             ` David Hildenbrand
2025-04-16 18:18               ` Johannes Weiner
2025-04-16 21:54                 ` Barry Song
2025-04-16 23:58                   ` Johannes Weiner [this message]
2025-04-17  2:43                     ` Barry Song
2025-04-17 12:17                       ` Johannes Weiner
2025-04-17 12:57                         ` David Hildenbrand
2025-04-18  0:16                           ` Barry Song

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=20250416235849.GA780688@cmpxchg.org \
    --to=hannes@cmpxchg.org \
    --cc=21cnbao@gmail.com \
    --cc=akpm@linux-foundation.org \
    --cc=baolin.wang@linux.alibaba.com \
    --cc=david@redhat.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-mm@kvack.org \
    --cc=osalvador@suse.de \
    --cc=ryan.roberts@arm.com \
    --cc=v-songbaohua@oppo.com \
    --cc=willy@infradead.org \
    --cc=ziy@nvidia.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).