From: Andrew Morton <akpm@linux-foundation.org>
To: "zhaoyang.huang" <zhaoyang.huang@unisoc.com>
Cc: David Hildenbrand <david@redhat.com>,
Matthew Wilcox <willy@infradead.org>, Yu Zhao <yuzhao@google.com>,
<linux-mm@kvack.org>, <linux-kernel@vger.kernel.org>,
Zhaoyang Huang <huangzhaoyang@gmail.com>, <steve.kang@unisoc.com>
Subject: Re: [PATCH] mm: migrate LRU_REFS_MASK bits in folio_migrate_flags
Date: Wed, 25 Sep 2024 02:42:15 -0700 [thread overview]
Message-ID: <20240925024215.265614f6839e752882b1c28b@linux-foundation.org> (raw)
In-Reply-To: <20240925030225.236143-1-zhaoyang.huang@unisoc.com>
On Wed, 25 Sep 2024 11:02:25 +0800 "zhaoyang.huang" <zhaoyang.huang@unisoc.com> wrote:
> From: Zhaoyang Huang <zhaoyang.huang@unisoc.com>
>
> Bits of LRU_REFS_MASK are not inherited during migration which lead to
> new_folio start from tier0. Fix this by migrate the bits domain.
I'm having trouble understanding this, sorry. Please more fully
describe the runtime effects of this flaw.
> --- a/include/linux/mm_inline.h
> +++ b/include/linux/mm_inline.h
> @@ -291,6 +291,12 @@ static inline bool lru_gen_del_folio(struct lruvec *lruvec, struct folio *folio,
> return true;
> }
>
> +static inline void folio_migrate_refs(struct folio *new_folio, struct folio *folio)
> +{
> + unsigned long refs = READ_ONCE(folio->flags) & LRU_REFS_MASK;
> +
> + set_mask_bits(&new_folio->flags, LRU_REFS_MASK, refs);
> +}
> #else /* !CONFIG_LRU_GEN */
>
> static inline bool lru_gen_enabled(void)
> @@ -313,6 +319,8 @@ static inline bool lru_gen_del_folio(struct lruvec *lruvec, struct folio *folio,
> return false;
> }
>
> +static inline void folio_migrate_refs(struct folio *new_folio, struct folio *folio)
> +{}
> #endif /* CONFIG_LRU_GEN */
>
> static __always_inline
> diff --git a/mm/migrate.c b/mm/migrate.c
> index 923ea80ba744..60c97e235ae7 100644
> --- a/mm/migrate.c
> +++ b/mm/migrate.c
> @@ -618,6 +618,7 @@ void folio_migrate_flags(struct folio *newfolio, struct folio *folio)
> if (folio_test_idle(folio))
> folio_set_idle(newfolio);
>
> + folio_migrate_refs(newfolio, folio);
> /*
> * Copy NUMA information to the new page, to prevent over-eager
> * future migrations of this same page.
> --
> 2.25.1
next prev parent reply other threads:[~2024-09-25 9:42 UTC|newest]
Thread overview: 4+ messages / expand[flat|nested] mbox.gz Atom feed top
2024-09-25 3:02 zhaoyang.huang
2024-09-25 9:42 ` Andrew Morton [this message]
2024-09-25 11:49 ` Zhaoyang Huang
2024-09-25 21:22 ` Yu Zhao
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=20240925024215.265614f6839e752882b1c28b@linux-foundation.org \
--to=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=yuzhao@google.com \
--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