linux-mm.kvack.org archive mirror
 help / color / mirror / Atom feed
From: Minchan Kim <minchan@kernel.org>
To: Barry Song <21cnbao@gmail.com>
Cc: Andrew Morton <akpm@linux-foundation.org>,
	yuzhao@google.com, linux-mm@kvack.org, david@redhat.com,
	fengbaopeng@honor.com, gaoxu2@honor.com, hailong.liu@oppo.com,
	kaleshsingh@google.com, linux-kernel@vger.kernel.org,
	lokeshgidra@google.com, mhocko@suse.com, ngeoffray@google.com,
	shli@fb.com, surenb@google.com, v-songbaohua@oppo.com,
	yipengxiang@honor.com, Gao Xu <gaoxu2@hihonor.com>
Subject: Re: [PATCH v2] mm: mglru: provide a separate list for lazyfree anon folios
Date: Thu, 17 Oct 2024 10:58:38 -0700	[thread overview]
Message-ID: <ZxFQTlPfR6y25cng@google.com> (raw)
In-Reply-To: <CAGsJ_4xYqSSUE_zq+2UWLT7UsF_ovH=+QE_va+_dcMq4fnz0rg@mail.gmail.com>

On Thu, Oct 17, 2024 at 06:59:09PM +1300, Barry Song wrote:
> On Thu, Oct 17, 2024 at 11:58 AM Andrew Morton
> <akpm@linux-foundation.org> wrote:
> >
> > On Wed, 16 Oct 2024 16:30:30 +1300 Barry Song <21cnbao@gmail.com> wrote:
> >
> > > To address this, this patch proposes maintaining a separate list
> > > for lazyfree anon folios while keeping them classified under the
> > > "file" LRU type to minimize code changes.
> >
> > Thanks.  I'll await input from other MGLRU developers before adding
> > this for testing.
> 
> Thanks!
> 
> Hi Minchan, Yu,
> 
> Any comments? I understand that Minchan may have a broader plan
> to "enable the system to maintain a quickly reclaimable memory
> pool and provide a knob for admins to control its size." While I
> have no objection to that plan, I believe improving MADV_FREE
> performance is a more urgent priority and a low-hanging fruit at this
> stage.

Hi Barry, 

I have no idea why my email didn't send well before. I sent following
reply on Sep 24. Hope it works this time.

====== &< ======

My proposal involves the following:

1. Introduce an "easily reclaimable" LRU list. This list would hold pages
   that can be quickly freed without significant overhead.

2. Implement a parameter to control the size of this list. This allows for
   system tuning based on available memory and performance requirements.

3. Modify kswapd behavior to utilize this list. When kswapd is awakened due
   to memory pressure, it should attempt to drop those pages first to refill
   free pages up to the high watermark by first reclaiming.

4. Before kswapd goes to sleep, it should scan the tail of the LRU list and
   move cold pages to the easily reclaimable list, unmapping them from the
   page table.

5. Whenever page cache hit, move the page into evictable LRU.

This approach allows the system to maintain a pool of readily available
memory, mitigating the "aging" problem. The trade-off is the potential for
minor page faults and LRU movement ovehreads if these pages in ez_reclaimable
LRU are accessed again.

Furthermore, we could put some asynchrnous writeback pages(e.g., swap
out or writeback the fs pages) into the list, too.
Currently, what we are doing is rotate those pages back to head of LRU
and once writeback is done, move the page to the tail of LRU again.
We can simply put the page into ez_reclaimable LRU without rotating
back and forth.


  parent reply	other threads:[~2024-12-05 15:26 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2024-10-16  3:30 Barry Song
2024-10-16 22:58 ` Andrew Morton
     [not found]   ` <CAGsJ_4xYqSSUE_zq+2UWLT7UsF_ovH=+QE_va+_dcMq4fnz0rg@mail.gmail.com>
2024-10-17 17:58     ` Minchan Kim [this message]
2024-10-18  5:12       ` Barry Song
2024-10-22 20:15         ` Minchan Kim
2024-10-28  6:54           ` 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=ZxFQTlPfR6y25cng@google.com \
    --to=minchan@kernel.org \
    --cc=21cnbao@gmail.com \
    --cc=akpm@linux-foundation.org \
    --cc=david@redhat.com \
    --cc=fengbaopeng@honor.com \
    --cc=gaoxu2@hihonor.com \
    --cc=gaoxu2@honor.com \
    --cc=hailong.liu@oppo.com \
    --cc=kaleshsingh@google.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-mm@kvack.org \
    --cc=lokeshgidra@google.com \
    --cc=mhocko@suse.com \
    --cc=ngeoffray@google.com \
    --cc=shli@fb.com \
    --cc=surenb@google.com \
    --cc=v-songbaohua@oppo.com \
    --cc=yipengxiang@honor.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