From: Rik van Riel <riel@surriel.com>
To: David Hildenbrand <david@redhat.com>,
Andrew Morton <akpm@linux-foundation.org>
Cc: Chris Li <chrisl@kernel.org>, Ryan Roberts <ryan.roberts@arm.com>,
"Matthew Wilcox (Oracle)" <willy@infradead.org>,
linux-kernel@vger.kernel.org, linux-mm@kvack.org,
kernel-team@meta.com
Subject: Re: [PATCH] mm: add maybe_lru_add_drain() that only drains when threshold is exceeded
Date: Thu, 19 Dec 2024 09:11:07 -0500 [thread overview]
Message-ID: <58d69446edb0e2b3b4edec442043cd0a9748f15f.camel@surriel.com> (raw)
In-Reply-To: <189f4767-e7c2-4522-b943-b644126bf897@redhat.com>
On Thu, 2024-12-19 at 14:47 +0100, David Hildenbrand wrote:
>
> > +++ b/mm/swap_state.c
> > @@ -317,7 +317,7 @@ void free_pages_and_swap_cache(struct
> > encoded_page **pages, int nr)
> > struct folio_batch folios;
> > unsigned int refs[PAGEVEC_SIZE];
> >
> > - lru_add_drain();
> > + maybe_lru_add_drain();
>
> I'm wondering about the reason+effect of this existing call.
>
> Seems to date back to the beginning of git.
>
> Likely it doesn't make sense to have effectively-free pages in the
> LRU+mlock cache. But then, this only considers the local CPU
> LRU/mlock
> caches ... hmmm
>
> So .... do we need this at all? :)
>
That is a very good question.
I think we need to free those pending pages at
some point. They can't accumulate there forever.
However, I am not sure where those points should
be.
I can think of a few considerations:
1) We should consider approximate LRU ordering,
and move pages onto the LRU every once in a
while.
2) When we are trying to free memory, we should
maybe ensure not too many pages are in these
temporary buffers?
3) For lock batching reasons, we do not want to
drain these buffers too frequently.
My patch takes a small step in the direction of
more batching, but maybe we can take a larger one?
--
All Rights Reversed.
next prev parent reply other threads:[~2024-12-19 14:11 UTC|newest]
Thread overview: 8+ messages / expand[flat|nested] mbox.gz Atom feed top
2024-12-18 16:56 Rik van Riel
2024-12-18 20:20 ` Shakeel Butt
2024-12-19 3:13 ` Rik van Riel
2024-12-19 17:00 ` Shakeel Butt
2024-12-19 13:47 ` David Hildenbrand
2024-12-19 14:11 ` Rik van Riel [this message]
2024-12-19 17:23 ` David Hildenbrand
2024-12-19 17:50 ` Rik van Riel
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=58d69446edb0e2b3b4edec442043cd0a9748f15f.camel@surriel.com \
--to=riel@surriel.com \
--cc=akpm@linux-foundation.org \
--cc=chrisl@kernel.org \
--cc=david@redhat.com \
--cc=kernel-team@meta.com \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-mm@kvack.org \
--cc=ryan.roberts@arm.com \
--cc=willy@infradead.org \
/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