From: Yu Zhao <yuzhao@google.com>
To: "zhaoyang.huang" <zhaoyang.huang@unisoc.com>
Cc: Andrew Morton <akpm@linux-foundation.org>,
David Hildenbrand <david@redhat.com>,
Matthew Wilcox <willy@infradead.org>,
linux-mm@kvack.org, linux-kernel@vger.kernel.org,
Zhaoyang Huang <huangzhaoyang@gmail.com>,
steve.kang@unisoc.com
Subject: Re: [PATCH] mm: deal with active/inactive inversion in lru_gen_is_active
Date: Thu, 10 Oct 2024 21:09:09 -0600 [thread overview]
Message-ID: <CAOUHufaDPcw7Dc95kgCXM04OhnSWKkZMhMCBAMXToj-=5dt3Gg@mail.gmail.com> (raw)
In-Reply-To: <20240930063912.196526-1-zhaoyang.huang@unisoc.com>
On Mon, Sep 30, 2024 at 12:39 AM zhaoyang.huang
<zhaoyang.huang@unisoc.com> wrote:
>
> From: Zhaoyang Huang <zhaoyang.huang@unisoc.com>
>
> All gens will be deemed as active by lru_gen_is_active when there are
> only two generations within the node, which could have the folios
> to be active in the belowing scenarios. This commit would like to
> solve this by judging if numbers of file type gens greater than two
> since anon gens could be remains as 3
> when swap is constrained
Technically, yes. But this patch doesn't detect whether swap is
constrained or not. Even if it did, I don't think it would matter
because no one should care about active/inactive anon when swap is
permanently disabled. One could argue the temporary case, but then why
would/should we care about a transient condition if that's the problem
you are trying to solve?
Most importantly, this breaks the proactive aging via the debugfs
interface, which can override swappiness (swap being disabled).
> and file
> type seq advanced by 1.
>
> 1. New folios after migration done.
> 2. Dropped folios from none-reclaiming context(drop_cache, madvise)
> when they are failed of being reclaimed and go back to lru.
>
> Signed-off-by: Zhaoyang Huang <zhaoyang.huang@unisoc.com>
> ---
> include/linux/mm_inline.h | 9 +++++++--
> 1 file changed, 7 insertions(+), 2 deletions(-)
>
> diff --git a/include/linux/mm_inline.h b/include/linux/mm_inline.h
> index 6f801c7b36e2..5e4017dbec96 100644
> --- a/include/linux/mm_inline.h
> +++ b/include/linux/mm_inline.h
> @@ -165,11 +165,16 @@ static inline int folio_lru_gen(struct folio *folio)
> static inline bool lru_gen_is_active(struct lruvec *lruvec, int gen)
> {
> unsigned long max_seq = lruvec->lrugen.max_seq;
> + unsigned long min_seq = lruvec->lrugen.min_seq[LRU_GEN_FILE];
>
> VM_WARN_ON_ONCE(gen >= MAX_NR_GENS);
>
> - /* see the comment on MIN_NR_GENS */
> - return gen == lru_gen_from_seq(max_seq) || gen == lru_gen_from_seq(max_seq - 1);
> + /* see the comment on MIN_NR_GENS
> + * judge if there is active/inactive inversion by the number of file
> + * type gens.
> + */
> + return gen == lru_gen_from_seq(max_seq) ||
> + max_seq - min_seq >= 2 ? gen == lru_gen_from_seq(max_seq - 1) : 0;
> }
>
> static inline void lru_gen_update_size(struct lruvec *lruvec, struct folio *folio,
> --
> 2.25.1
>
>
prev parent reply other threads:[~2024-10-11 3:09 UTC|newest]
Thread overview: 2+ messages / expand[flat|nested] mbox.gz Atom feed top
2024-09-30 6:39 zhaoyang.huang
2024-10-11 3:09 ` Yu Zhao [this message]
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='CAOUHufaDPcw7Dc95kgCXM04OhnSWKkZMhMCBAMXToj-=5dt3Gg@mail.gmail.com' \
--to=yuzhao@google.com \
--cc=akpm@linux-foundation.org \
--cc=david@redhat.com \
--cc=huangzhaoyang@gmail.com \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-mm@kvack.org \
--cc=steve.kang@unisoc.com \
--cc=willy@infradead.org \
--cc=zhaoyang.huang@unisoc.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