#include <linux/kernel.h>
#include <linux/errno.h>
#include <linux/topology.h>
#include <linux/memblock.h>
#include <linux/numa_memblks.h>
#include <asm/numa.h>
#define FAKE_NODE_MIN_SIZE …
#define FAKE_NODE_MIN_HASH_MASK …
static int emu_nid_to_phys[MAX_NUMNODES];
static char *emu_cmdline __initdata;
int __init numa_emu_cmdline(char *str)
{ … }
static int __init emu_find_memblk_by_nid(int nid, const struct numa_meminfo *mi)
{ … }
static u64 __init mem_hole_size(u64 start, u64 end)
{ … }
static int __init emu_setup_memblk(struct numa_meminfo *ei,
struct numa_meminfo *pi,
int nid, int phys_blk, u64 size)
{ … }
static int __init split_nodes_interleave(struct numa_meminfo *ei,
struct numa_meminfo *pi,
u64 addr, u64 max_addr, int nr_nodes)
{ … }
static u64 __init find_end_of_node(u64 start, u64 max_addr, u64 size)
{ … }
static u64 uniform_size(u64 max_addr, u64 base, u64 hole, int nr_nodes)
{ … }
static int __init split_nodes_size_interleave_uniform(struct numa_meminfo *ei,
struct numa_meminfo *pi,
u64 addr, u64 max_addr, u64 size,
int nr_nodes, struct numa_memblk *pblk,
int nid)
{ … }
static int __init split_nodes_size_interleave(struct numa_meminfo *ei,
struct numa_meminfo *pi,
u64 addr, u64 max_addr, u64 size)
{ … }
static int __init setup_emu2phys_nid(int *dfl_phys_nid)
{ … }
void __init numa_emulation(struct numa_meminfo *numa_meminfo, int numa_dist_cnt)
{ … }
#ifndef CONFIG_DEBUG_PER_CPU_MAPS
void numa_add_cpu(unsigned int cpu)
{
int physnid, nid;
nid = early_cpu_to_node(cpu);
BUG_ON(nid == NUMA_NO_NODE || !node_online(nid));
physnid = emu_nid_to_phys[nid];
for_each_online_node(nid)
if (emu_nid_to_phys[nid] == physnid)
cpumask_set_cpu(cpu, node_to_cpumask_map[nid]);
}
void numa_remove_cpu(unsigned int cpu)
{
int i;
for_each_online_node(i)
cpumask_clear_cpu(cpu, node_to_cpumask_map[i]);
}
#else
static void numa_set_cpumask(unsigned int cpu, bool enable)
{ … }
void numa_add_cpu(unsigned int cpu)
{ … }
void numa_remove_cpu(unsigned int cpu)
{ … }
#endif