mirror of
https://github.com/torvalds/linux.git
synced 2026-11-30 02:23:05 +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. [[email protected]: arch/s390: save_area_alloc default failure behavior changed to panic] Link: https://lkml.kernel.org/r/[email protected] Link: https://lore.kernel.org/lkml/[email protected]/ Link: https://lkml.kernel.org/r/[email protected] Signed-off-by: Guo Weikang <[email protected]> Acked-by: Geert Uytterhoeven <[email protected]> [m68k] Reviewed-by: Alexander Gordeev <[email protected]> [s390] Acked-by: Mike Rapoport (Microsoft) <[email protected]> Cc: Alexander Gordeev <[email protected]> Signed-off-by: Andrew Morton <[email protected]>
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;
|
|
}
|