From: Matthew Wilcox <willy@infradead.org>
To: Anshuman Khandual <anshuman.khandual@arm.com>
Cc: linux-mm@kvack.org, Vishal Moola <vishal.moola@gmail.com>,
Johannes Weiner <hannes@cmpxchg.org>,
Joerg Roedel <jroedel@suse.de>
Subject: Re: [RFC PATCH 5/7] x86: Call preallocate_vmalloc_pages() later
Date: Thu, 13 Nov 2025 13:53:58 +0000 [thread overview]
Message-ID: <aRXi9gIwA_eyUFJI@casper.infradead.org> (raw)
In-Reply-To: <29319ba1-9093-4ec4-b84a-3c60d2b00264@arm.com>
On Tue, Nov 11, 2025 at 02:29:44PM +0530, Anshuman Khandual wrote:
> pt_page has not been added as an element into ptdesc and hence
> the build fails upto this patch.
Right, sorry, looks like the commit went astray. Those lines should
have been in a lter patch, and this patch should have been as below.
Adding Joerg to the cc to see if this invocation of
preallocate_vmalloc_pages() is early enough. Also I'd like feedback on
whether we want to expose preallocate_vmalloc_pages() like this or if we
want something more bland as a name like arch_vmalloc_init().
commit b34c228df965
Author: Matthew Wilcox (Oracle) <willy@infradead.org>
Date: Sun Oct 19 18:34:36 2025 -0400
x86: Call preallocate_vmalloc_pages() later
When separately allocating ptdesc from struct page, calling
preallocate_vmalloc_pages() from mem_init() is too early as the slab
allocator hasn't been set up yet. Move preallocate_vmalloc_pages() to
vmalloc_init() which is called after the slab allocator has been set up.
Honestly, this patch is a bit bobbins and I'm sure it'll be reworked
before it goes upstream.
Signed-off-by: Matthew Wilcox (Oracle) <willy@infradead.org>
diff --git a/arch/x86/mm/init_64.c b/arch/x86/mm/init_64.c
index 3d9a5e4ccaa4..0006b2880bc0 100644
--- a/arch/x86/mm/init_64.c
+++ b/arch/x86/mm/init_64.c
@@ -1322,7 +1322,7 @@ static void __init register_page_bootmem_info(void)
* Only the level which needs to be synchronized between all page-tables is
* allocated because the synchronization can be expensive.
*/
-static void __init preallocate_vmalloc_pages(void)
+void __init preallocate_vmalloc_pages(void)
{
unsigned long addr;
const char *lvl;
@@ -1390,8 +1390,6 @@ void __init mem_init(void)
/* Register memory areas for /proc/kcore */
if (get_gate_vma(&init_mm))
kclist_add(&kcore_vsyscall, (void *)VSYSCALL_ADDR, PAGE_SIZE, KCORE_USER);
-
- preallocate_vmalloc_pages();
}
int kernel_set_to_readonly;
diff --git a/include/linux/mm.h b/include/linux/mm.h
index 3111344b8d05..00ea79340c0c 100644
--- a/include/linux/mm.h
+++ b/include/linux/mm.h
@@ -1177,6 +1177,12 @@ static inline int is_vmalloc_or_module_addr(const void *x)
}
#endif
+#ifdef CONFIG_X86
+void __init preallocate_vmalloc_pages(void);
+#else
+static inline void preallocate_vmalloc_pages(void) { }
+#endif
+
/*
* How many times the entire folio is mapped as a single unit (eg by a
* PMD or PUD entry). This is probably not what you want, except for
diff --git a/mm/vmalloc.c b/mm/vmalloc.c
index 0832f944544c..8af051136211 100644
--- a/mm/vmalloc.c
+++ b/mm/vmalloc.c
@@ -5385,6 +5385,8 @@ void __init vmalloc_init(void)
struct vm_struct *tmp;
int i;
+ preallocate_vmalloc_pages();
+
/*
* Create the cache for vmap_area objects.
*/
next prev parent reply other threads:[~2025-11-13 13:54 UTC|newest]
Thread overview: 17+ messages / expand[flat|nested] mbox.gz Atom feed top
2025-10-20 0:16 [RFC PATCH 0/7] Separate ptdesc from struct page Matthew Wilcox (Oracle)
2025-10-20 0:16 ` [RFC PATCH 1/7] mm: Use frozen pages for page tables Matthew Wilcox (Oracle)
2025-10-20 0:16 ` [RFC PATCH 2/7] mm: Account pagetable memory when allocated Matthew Wilcox (Oracle)
2025-11-11 7:09 ` Anshuman Khandual
2025-11-11 16:43 ` Matthew Wilcox
2025-10-20 0:16 ` [RFC PATCH 3/7] mm: Mark " Matthew Wilcox (Oracle)
2025-10-20 0:16 ` [RFC PATCH 4/7] pgtable: Remove uses of page->lru Matthew Wilcox (Oracle)
2025-11-11 7:53 ` Anshuman Khandual
2025-11-11 18:46 ` Matthew Wilcox
2025-10-20 0:16 ` [RFC PATCH 5/7] x86: Call preallocate_vmalloc_pages() later Matthew Wilcox (Oracle)
2025-11-11 8:59 ` Anshuman Khandual
2025-11-12 18:36 ` Vishal Moola (Oracle)
2025-11-12 19:31 ` Vishal Moola (Oracle)
2025-11-13 13:53 ` Matthew Wilcox [this message]
2025-10-20 0:16 ` [RFC PATCH 6/7] mm: Add alloc_pages_memdesc family of APIs Matthew Wilcox (Oracle)
2025-10-20 0:16 ` [RFC PATCH 7/7] mm: Allocate ptdesc from slab Matthew Wilcox (Oracle)
2025-10-20 6:43 ` [syzbot ci] Re: Separate ptdesc from struct page syzbot ci
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=aRXi9gIwA_eyUFJI@casper.infradead.org \
--to=willy@infradead.org \
--cc=anshuman.khandual@arm.com \
--cc=hannes@cmpxchg.org \
--cc=jroedel@suse.de \
--cc=linux-mm@kvack.org \
--cc=vishal.moola@gmail.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