Contributors: 18
Author Tokens Token Proportion Commits Commit Proportion
Mike Rapoport 65 27.90% 5 19.23%
Dan J Williams 38 16.31% 2 7.69%
Tejun Heo 35 15.02% 4 15.38%
Ganapatrao Kulkarni 26 11.16% 1 3.85%
Kent Overstreet 15 6.44% 1 3.85%
Anton Blanchard 7 3.00% 1 3.85%
Yasunori Goto 7 3.00% 1 3.85%
Philipp Hachtmann 7 3.00% 1 3.85%
Andi Kleen 5 2.15% 1 3.85%
Luiz Fernando N. Capitulino 5 2.15% 1 3.85%
guoweikang 5 2.15% 1 3.85%
Frank Munzert 4 1.72% 1 3.85%
Liu Ye 4 1.72% 1 3.85%
Catalin Marinas 3 1.29% 1 3.85%
Wen Congyang 2 0.86% 1 3.85%
Paul Mackerras 2 0.86% 1 3.85%
Heiko Carstens 2 0.86% 1 3.85%
Joerg Roedel 1 0.43% 1 3.85%
Total 233 26


// SPDX-License-Identifier: GPL-2.0-or-later

#include <linux/memblock.h>
#include <linux/printk.h>
#include <linux/numa.h>
#include <linux/numa_memblks.h>

struct pglist_data *node_data[MAX_NUMNODES];
EXPORT_SYMBOL(node_data);

/* Allocate NODE_DATA for a node on the local memory */
void __init alloc_node_data(int nid)
{
	const size_t nd_size = roundup(sizeof(pg_data_t), SMP_CACHE_BYTES);
	u64 nd_pa;
	int tnid;

	/* Allocate node data.  Try node-local memory and then any node. */
	nd_pa = memblock_phys_alloc_try_nid(nd_size, SMP_CACHE_BYTES, nid);
	if (!nd_pa)
		panic("Cannot allocate %zu bytes for node %d data\n",
		      nd_size, nid);

	/* report and initialize */
	pr_info("NODE_DATA(%d) allocated [mem %#010Lx-%#010Lx]\n", nid,
		nd_pa, nd_pa + nd_size - 1);
	tnid = early_pfn_to_nid(nd_pa >> PAGE_SHIFT);
	if (tnid != nid)
		pr_info("    NODE_DATA(%d) on node %d\n", nid, tnid);

	node_data[nid] = __va(nd_pa);
	memset(NODE_DATA(nid), 0, sizeof(pg_data_t));
}

void __init alloc_offline_node_data(int nid)
{
	pg_data_t *pgdat;
	node_data[nid] = memblock_alloc_or_panic(sizeof(*pgdat), SMP_CACHE_BYTES);
}

/* Stub functions: */

#ifndef memory_add_physaddr_to_nid
int memory_add_physaddr_to_nid(u64 start)
{
	pr_info_once("Unknown online node for memory at 0x%llx, assuming node 0\n",
			start);
	return 0;
}
EXPORT_SYMBOL_GPL(memory_add_physaddr_to_nid);
#endif

#ifndef phys_to_target_node
int phys_to_target_node(u64 start)
{
	pr_info_once("Unknown target node for memory at 0x%llx, assuming node 0\n",
			start);
	return 0;
}
EXPORT_SYMBOL_GPL(phys_to_target_node);
#endif