mirror of
git://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
synced 2025-08-05 16:54:27 +00:00
mm/hugetlb: use online nodes for bootmem allocation
Later commits will move hugetlb bootmem allocation to earlier in init, when N_MEMORY has not yet been set on nodes. Use online nodes instead. At most, this wastes just a few cycles once during boot (and most likely none). Link: https://lkml.kernel.org/r/20250228182928.2645936-7-fvdl@google.com Signed-off-by: Frank van der Linden <fvdl@google.com> Cc: Alexander Gordeev <agordeev@linux.ibm.com> Cc: Andy Lutomirski <luto@kernel.org> Cc: Arnd Bergmann <arnd@arndb.de> Cc: Dan Carpenter <dan.carpenter@linaro.org> Cc: Dave Hansen <dave.hansen@linux.intel.com> Cc: David Hildenbrand <david@redhat.com> Cc: Heiko Carstens <hca@linux.ibm.com> Cc: Joao Martins <joao.m.martins@oracle.com> Cc: Johannes Weiner <hannes@cmpxchg.org> Cc: Madhavan Srinivasan <maddy@linux.ibm.com> Cc: Michael Ellerman <mpe@ellerman.id.au> Cc: Muchun Song <muchun.song@linux.dev> Cc: Oscar Salvador <osalvador@suse.de> Cc: Peter Zijlstra <peterz@infradead.org> Cc: Roman Gushchin (Cruise) <roman.gushchin@linux.dev> Cc: Usama Arif <usamaarif642@gmail.com> Cc: Vasily Gorbik <gor@linux.ibm.com> Cc: Yu Zhao <yuzhao@google.com> Cc: Zi Yan <ziy@nvidia.com> Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
This commit is contained in:
parent
992e5491b6
commit
de55996d71
1 changed files with 3 additions and 3 deletions
|
@ -3164,7 +3164,7 @@ int __alloc_bootmem_huge_page(struct hstate *h, int nid)
|
||||||
goto found;
|
goto found;
|
||||||
}
|
}
|
||||||
/* allocate from next node when distributing huge pages */
|
/* allocate from next node when distributing huge pages */
|
||||||
for_each_node_mask_to_alloc(&h->next_nid_to_alloc, nr_nodes, node, &node_states[N_MEMORY]) {
|
for_each_node_mask_to_alloc(&h->next_nid_to_alloc, nr_nodes, node, &node_states[N_ONLINE]) {
|
||||||
m = memblock_alloc_try_nid_raw(
|
m = memblock_alloc_try_nid_raw(
|
||||||
huge_page_size(h), huge_page_size(h),
|
huge_page_size(h), huge_page_size(h),
|
||||||
0, MEMBLOCK_ALLOC_ACCESSIBLE, node);
|
0, MEMBLOCK_ALLOC_ACCESSIBLE, node);
|
||||||
|
@ -4558,8 +4558,8 @@ void __init hugetlb_add_hstate(unsigned int order)
|
||||||
for (i = 0; i < MAX_NUMNODES; ++i)
|
for (i = 0; i < MAX_NUMNODES; ++i)
|
||||||
INIT_LIST_HEAD(&h->hugepage_freelists[i]);
|
INIT_LIST_HEAD(&h->hugepage_freelists[i]);
|
||||||
INIT_LIST_HEAD(&h->hugepage_activelist);
|
INIT_LIST_HEAD(&h->hugepage_activelist);
|
||||||
h->next_nid_to_alloc = first_memory_node;
|
h->next_nid_to_alloc = first_online_node;
|
||||||
h->next_nid_to_free = first_memory_node;
|
h->next_nid_to_free = first_online_node;
|
||||||
snprintf(h->name, HSTATE_NAME_LEN, "hugepages-%lukB",
|
snprintf(h->name, HSTATE_NAME_LEN, "hugepages-%lukB",
|
||||||
huge_page_size(h)/SZ_1K);
|
huge_page_size(h)/SZ_1K);
|
||||||
|
|
||||||
|
|
Loading…
Add table
Reference in a new issue