From: Jan Polensky <japo@linux.ibm.com>
To: catalin.marinas@arm.com
Cc: akpm@linux-foundation.org, david@redhat.com,
linux-arm-kernel@lists.infradead.org, linux-mm@kvack.org,
will@kernel.org
Subject: [PATCH] mm/huge_memory: restrict __GFP_ZEROTAGS to HW tagging architectures
Date: Sun, 9 Nov 2025 01:36:13 +0100 [thread overview]
Message-ID: <20251109003613.1461433-1-japo@linux.ibm.com> (raw)
In-Reply-To: <20251031170133.280742-1-catalin.marinas@arm.com>
The previous change added __GFP_ZEROTAGS when allocating the huge zero
folio to ensure tag initialization for arm64 with MTE enabled. However,
on s390 this flag is unnecessary and triggers a regression
(observed as a crash during repeated 'dnf makecache').
Restrict the use of __GFP_ZEROTAGS to architectures that support
hardware memory tagging (currently arm64 with MTE or KASAN HW tags).
This avoids unintended side effects on other platforms.
Fixes: 1579227fe0f0 ("mm/huge_memory: initialise the tags of the huge zero folio")
Link: https://lore.kernel.org/r/20251031170133.280742-1-catalin.marinas@arm.com
Signed-off-by: Jan Polensky <japo@linux.ibm.com>
---
mm/huge_memory.c | 9 +++++----
1 file changed, 5 insertions(+), 4 deletions(-)
diff --git a/mm/huge_memory.c b/mm/huge_memory.c
index aae283b00857..0c1794656d7a 100644
--- a/mm/huge_memory.c
+++ b/mm/huge_memory.c
@@ -209,14 +209,15 @@ unsigned long __thp_vma_allowable_orders(struct vm_area_struct *vma,
static bool get_huge_zero_folio(void)
{
+ gfp_t gfp = (GFP_TRANSHUGE | __GFP_ZERO) & ~__GFP_MOVABLE;
struct folio *zero_folio;
retry:
if (likely(atomic_inc_not_zero(&huge_zero_refcount)))
return true;
-
- zero_folio = folio_alloc((GFP_TRANSHUGE | __GFP_ZERO | __GFP_ZEROTAGS) &
- ~__GFP_MOVABLE,
- HPAGE_PMD_ORDER);
+#if IS_ENABLED(CONFIG_KASAN_HW_TAGS) || IS_ENABLED(CONFIG_ARM64_MTE)
+ gfp |= __GFP_ZEROTAGS;
+#endif
+ zero_folio = folio_alloc(gfp, HPAGE_PMD_ORDER);
if (!zero_folio) {
count_vm_event(THP_ZERO_PAGE_ALLOC_FAILED);
return false;
--
2.48.1
next prev parent reply other threads:[~2025-11-09 0:36 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 ` Jan Polensky [this message]
2025-11-10 9:09 ` [PATCH] mm/huge_memory: restrict __GFP_ZEROTAGS to HW tagging architectures 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
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=20251109003613.1461433-1-japo@linux.ibm.com \
--to=japo@linux.ibm.com \
--cc=akpm@linux-foundation.org \
--cc=catalin.marinas@arm.com \
--cc=david@redhat.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