mirror of
https://git.kernel.org/pub/scm/linux/kernel/git/chenhuacai/linux-loongson
synced 2025-08-27 06:50:37 +00:00

Before SLUB initialization, various subsystems used memblock_alloc to allocate memory. In most cases, when memory allocation fails, an immediate panic is required. To simplify this behavior and reduce repetitive checks, introduce `memblock_alloc_or_panic`. This function ensures that memory allocation failures result in a panic automatically, improving code readability and consistency across subsystems that require this behavior. [guoweikang.kernel@gmail.com: arch/s390: save_area_alloc default failure behavior changed to panic] Link: https://lkml.kernel.org/r/20250109033136.2845676-1-guoweikang.kernel@gmail.com Link: https://lore.kernel.org/lkml/Z2fknmnNtiZbCc7x@kernel.org/ Link: https://lkml.kernel.org/r/20250102072528.650926-1-guoweikang.kernel@gmail.com Signed-off-by: Guo Weikang <guoweikang.kernel@gmail.com> Acked-by: Geert Uytterhoeven <geert@linux-m68k.org> [m68k] Reviewed-by: Alexander Gordeev <agordeev@linux.ibm.com> [s390] Acked-by: Mike Rapoport (Microsoft) <rppt@kernel.org> Cc: Alexander Gordeev <agordeev@linux.ibm.com> Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
29 lines
627 B
C
29 lines
627 B
C
// SPDX-License-Identifier: GPL-2.0
|
|
/*
|
|
* NUMA support for s390
|
|
*
|
|
* Implement NUMA core code.
|
|
*
|
|
* Copyright IBM Corp. 2015
|
|
*/
|
|
|
|
#include <linux/kernel.h>
|
|
#include <linux/mmzone.h>
|
|
#include <linux/cpumask.h>
|
|
#include <linux/memblock.h>
|
|
#include <linux/node.h>
|
|
#include <asm/numa.h>
|
|
|
|
void __init numa_setup(void)
|
|
{
|
|
int nid;
|
|
|
|
nodes_clear(node_possible_map);
|
|
node_set(0, node_possible_map);
|
|
node_set_online(0);
|
|
for (nid = 0; nid < MAX_NUMNODES; nid++)
|
|
NODE_DATA(nid) = memblock_alloc_or_panic(sizeof(pg_data_t), 8);
|
|
NODE_DATA(0)->node_spanned_pages = memblock_end_of_DRAM() >> PAGE_SHIFT;
|
|
NODE_DATA(0)->node_id = 0;
|
|
}
|