From: Em Sharnoff <sharnoff@neon.tech>
To: linux-kernel@vger.kernel.org, x86@kernel.org, linux-mm@kvack.org
Cc: Dave Hansen <dave.hansen@linux.intel.com>,
Andy Lutomirski <luto@kernel.org>,
Peter Zijlstra <peterz@infradead.org>,
Thomas Gleixner <tglx@linutronix.de>,
Ingo Molnar <mingo@redhat.com>, Borislav Petkov <bp@alien8.de>,
"H. Peter Anvin" <hpa@zytor.com>,
"Edgecombe, Rick P" <rick.p.edgecombe@intel.com>,
Oleg Vasilev <oleg@neon.tech>,
Arthur Petukhovsky <arthur@neon.tech>,
Stefan Radig <stefan@neon.tech>, Misha Sakhnov <misha@neon.tech>
Subject: [PATCH v5 4/4] x86/mm: Use GFP_KERNEL for alloc_low_pages() after boot
Date: Fri, 11 Jul 2025 17:26:08 +0100 [thread overview]
Message-ID: <51de7373-1b8d-426d-b720-ad9134c170bd@neon.tech> (raw)
In-Reply-To: <4fe0984f-74dc-45fe-b2b6-bdd81ec15bac@neon.tech>
Currently it's GFP_ATOMIC. GFP_KERNEL seems more correct.
From Ingo M. [1]
> There's no real reason why it should be GFP_ATOMIC AFAICS, other than
> some historic inertia that nobody bothered to fix.
and previously Mike R. [2]
> The few callers that effectively use page allocator for the direct map
> updates are gart_iommu_init() and memory hotplug. Neither of them
> happen in an atomic context so there is no reason to use GFP_ATOMIC
> for these allocations.
>
> Replace GFP_ATOMIC with GFP_KERNEL to avoid using atomic reserves for
> allocations that do not require that.
[1]: https://lore.kernel.org/all/aEE6_S2a-1tk1dtI@gmail.com/
[2]: https://lore.kernel.org/all/20211111110241.25968-5-rppt@kernel.org/
Signed-off-by: Em Sharnoff <sharnoff@neon.tech>
---
Changelog:
- v2: Add this patch
- v3: No changes
- v4: No changes
---
arch/x86/mm/init.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/arch/x86/mm/init.c b/arch/x86/mm/init.c
index 474a7294016c..b37ac1d546af 100644
--- a/arch/x86/mm/init.c
+++ b/arch/x86/mm/init.c
@@ -132,7 +132,7 @@ __ref void *alloc_low_pages(unsigned int num)
unsigned int order;
order = get_order((unsigned long)num << PAGE_SHIFT);
- return (void *)__get_free_pages(GFP_ATOMIC | __GFP_ZERO, order);
+ return (void *)__get_free_pages(GFP_KERNEL | __GFP_ZERO, order);
}
if ((pgt_buf_end + num) > pgt_buf_top || !can_use_brk_pgt) {
--
2.39.5
prev parent reply other threads:[~2025-07-11 16:26 UTC|newest]
Thread overview: 5+ messages / expand[flat|nested] mbox.gz Atom feed top
2025-07-11 16:22 [PATCH v5 0/4] x86/mm: Improve alloc handling of phys_*_init() Em Sharnoff
2025-07-11 16:24 ` [PATCH v5 1/4] x86/mm: Update mapped addresses in phys_{pmd,pud}_init() Em Sharnoff
2025-07-11 16:25 ` [PATCH v5 2/4] x86/mm: Allow error returns from phys_*_init() Em Sharnoff
2025-07-11 16:25 ` [PATCH v5 3/4] x86/mm: Handle alloc failure in phys_*_init() Em Sharnoff
2025-07-11 16:26 ` Em Sharnoff [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=51de7373-1b8d-426d-b720-ad9134c170bd@neon.tech \
--to=sharnoff@neon.tech \
--cc=arthur@neon.tech \
--cc=bp@alien8.de \
--cc=dave.hansen@linux.intel.com \
--cc=hpa@zytor.com \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-mm@kvack.org \
--cc=luto@kernel.org \
--cc=mingo@redhat.com \
--cc=misha@neon.tech \
--cc=oleg@neon.tech \
--cc=peterz@infradead.org \
--cc=rick.p.edgecombe@intel.com \
--cc=stefan@neon.tech \
--cc=tglx@linutronix.de \
--cc=x86@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