From: Jan Polensky <japo@linux.ibm.com>
To: "David Hildenbrand (Red Hat)" <davidhildenbrandkernel@gmail.com>,
catalin.marinas@arm.com
Cc: akpm@linux-foundation.org, linux-arm-kernel@lists.infradead.org,
linux-mm@kvack.org, will@kernel.org
Subject: Re: [PATCH] mm/huge_memory: restrict __GFP_ZEROTAGS to HW tagging architectures
Date: Tue, 11 Nov 2025 11:44:06 +0100 [thread overview]
Message-ID: <aRMTdt5tqJhjLgGd@li-276bd24c-2dcc-11b2-a85c-945b6f05615c.ibm.com> (raw)
In-Reply-To: <fbca7868-6f68-4b98-a2f2-e39eb46b7f12@gmail.com>
On Mon, Nov 10, 2025 at 10:53:33AM +0100, David Hildenbrand (Red Hat) wrote:
> On 10.11.25 10:48, Jan Polensky wrote:
> > On Mon, Nov 10, 2025 at 10:09:31AM +0100, David Hildenbrand (Red Hat) wrote:
> > > On 09.11.25 01:36, Jan Polensky wrote:
---8<--- snip ---8<---
> > > I wonder if the following would work:
> > >
> > >
> > > diff --git a/include/linux/gfp_types.h b/include/linux/gfp_types.h
> > > index 65db9349f9053..56b82e116cb79 100644
> > > --- a/include/linux/gfp_types.h
> > > +++ b/include/linux/gfp_types.h
> > > @@ -47,7 +47,9 @@ enum {
> > > ___GFP_HARDWALL_BIT,
> > > ___GFP_THISNODE_BIT,
> > > ___GFP_ACCOUNT_BIT,
> > > +#ifdef __HAVE_ARCH_TAG_CLEAR_HIGHPAGE
> > > ___GFP_ZEROTAGS_BIT,
> > > +#endif
> > > #ifdef CONFIG_KASAN_HW_TAGS
> > > ___GFP_SKIP_ZERO_BIT,
> > > ___GFP_SKIP_KASAN_BIT,
> > > @@ -85,7 +87,11 @@ enum {
> > > #define ___GFP_HARDWALL BIT(___GFP_HARDWALL_BIT)
> > > #define ___GFP_THISNODE BIT(___GFP_THISNODE_BIT)
> > > #define ___GFP_ACCOUNT BIT(___GFP_ACCOUNT_BIT)
> > > +#ifdef __HAVE_ARCH_TAG_CLEAR_HIGHPAGE
> > > #define ___GFP_ZEROTAGS BIT(___GFP_ZEROTAGS_BIT)
> > > +#else
> > > +#define ___GFP_ZEROTAGS 0
> > > +#endif
> > > #ifdef CONFIG_KASAN_HW_TAGS
> > > #define ___GFP_SKIP_ZERO BIT(___GFP_SKIP_ZERO_BIT)
> > > #define ___GFP_SKIP_KASAN BIT(___GFP_SKIP_KASAN_BIT)
> > >
> > >
> > > Likely we'd have to make __HAVE_ARCH_TAG_CLEAR_HIGHPAGE a proper
> > > kconfig option.
> > >
> > >
> > > Then we could turn the default implementation of
> > > tag_clear_highpage() into a BUILD_BUG.
> > >
> > I'd like to suggest to keep the enum untouched and only use the second
> > part of your suggestion.
>
> Why? We also do that for CONFIG_KASAN_HW_TAGS, CONFIG_LOCKDEP and
> CONFIG_SLAB_OBJ_EXT.
If we remove the enum entry, we’d also need to update mmflags.h because
the trace macros reference it.
Enums are compile-time only, so they don’t affect the generated binary.
My thought was to keep the enum list as it is and just apply the second
part of your suggestion.
That way, the trace definitions stay consistent without extra changes.
Just an idea, happy to go with whatever you prefer.
>
> > Which works by the way for our arch (s390).
> >
> > include/linux/gfp_types.h | 4 ++++
> > 1 file changed, 4 insertions(+)
> >
> > diff --git a/include/linux/gfp_types.h b/include/linux/gfp_types.h
> > index 65db9349f905..c12d8a601bb3 100644
> > --- a/include/linux/gfp_types.h
> > +++ b/include/linux/gfp_types.h
> > @@ -85,7 +85,11 @@ enum {
> > #define ___GFP_HARDWALL BIT(___GFP_HARDWALL_BIT)
> > #define ___GFP_THISNODE BIT(___GFP_THISNODE_BIT)
> > #define ___GFP_ACCOUNT BIT(___GFP_ACCOUNT_BIT)
> > +#ifdef __HAVE_ARCH_TAG_CLEAR_HIGHPAGE
> > #define ___GFP_ZEROTAGS BIT(___GFP_ZEROTAGS_BIT)
> > +#else
> > +#define ___GFP_ZEROTAGS 0
> > +#endif
> > #ifdef CONFIG_KASAN_HW_TAGS
> > #define ___GFP_SKIP_ZERO BIT(___GFP_SKIP_ZERO_BIT)
> > #define ___GFP_SKIP_KASAN BIT(___GFP_SKIP_KASAN_BIT)
> >
> > This solution would be sufficient from my side, and I would appreciate a
> > quick application if there are no objections.
>
> As raised, to be sure that __HAVE_ARCH_TAG_CLEAR_HIGHPAGE is always seen
> early in that file, it should likely become a CONFIG_ thing.
>
next prev parent reply other threads:[~2025-11-11 10:44 UTC|newest]
Thread overview: 24+ messages / expand[flat|nested] mbox.gz Atom feed top
2025-10-31 16:57 [PATCH] mm/huge_memory: Initialise the tags of the huge zero folio Catalin Marinas
2025-10-31 17:15 ` David Hildenbrand
2025-11-03 13:32 ` Mark Brown
2025-11-03 14:30 ` Catalin Marinas
2025-11-03 14:41 ` David Hildenbrand (Red Hat)
2025-11-03 15:59 ` Catalin Marinas
2025-11-03 19:29 ` Beleswar Prasad Padhi
2025-11-04 1:05 ` Andrew Morton
2025-11-04 8:52 ` Catalin Marinas
2025-11-04 11:53 ` [PATCH] mm/huge_memory: Initialise the tags of the huge zero Lance Yang
2025-11-08 19:19 ` [PATCH] mm/huge_memory: initialise the tags of the huge zero folio Jan Polensky
2025-11-09 0:42 ` [PATCH] Clarification: please ignore earlier submission Jan Polensky
2025-11-09 0:36 ` [PATCH] mm/huge_memory: restrict __GFP_ZEROTAGS to HW tagging architectures Jan Polensky
2025-11-10 9:09 ` David Hildenbrand (Red Hat)
2025-11-10 9:48 ` Jan Polensky
2025-11-10 9:53 ` David Hildenbrand (Red Hat)
2025-11-10 15:28 ` Catalin Marinas
2025-11-10 15:55 ` Catalin Marinas
2025-11-22 12:04 ` Balbir Singh
2025-11-24 10:57 ` David Hildenbrand (Red Hat)
2025-11-24 18:08 ` Andrew Morton
2025-11-11 10:44 ` Jan Polensky [this message]
2025-11-11 12:27 ` David Hildenbrand (Red Hat)
2025-11-11 12:28 ` David Hildenbrand (Red Hat)
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=aRMTdt5tqJhjLgGd@li-276bd24c-2dcc-11b2-a85c-945b6f05615c.ibm.com \
--to=japo@linux.ibm.com \
--cc=akpm@linux-foundation.org \
--cc=catalin.marinas@arm.com \
--cc=davidhildenbrandkernel@gmail.com \
--cc=linux-arm-kernel@lists.infradead.org \
--cc=linux-mm@kvack.org \
--cc=will@kernel.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