/* * Get nodeid by logical cpu number. * __cpuid_to_node maps phyical cpu id to node, so we * should use cpu_logical_map(cpu) to index it. * * This routine is only used in early phase during * booting, after setup_per_cpu_areas calling and numa_node * initialization, cpu_to_node will be used instead.
*/ int early_cpu_to_node(int cpu)
{ int physid = cpu_logical_map(cpu);
if (physid < 0) return NUMA_NO_NODE;
return __cpuid_to_node[physid];
}
void __init early_numa_add_cpu(int cpuid, s16 node)
{ int cpu = __cpu_number_map[cpuid];
/* * add_numamem_region * * Add a uasable memory region described by BIOS. The * routine gets each intersection between BIOS's region * and node's region, and adds them into node's memblock * pool. *
*/ staticvoid __init add_numamem_region(u64 start, u64 end, u32 type)
{
u32 node = pa_to_nid(start);
u64 size = end - start; staticunsignedlong num_physpages;
switch (mem_type) { case EFI_LOADER_CODE: case EFI_LOADER_DATA: case EFI_BOOT_SERVICES_CODE: case EFI_BOOT_SERVICES_DATA: case EFI_PERSISTENT_MEMORY: case EFI_CONVENTIONAL_MEMORY:
add_numamem_region(mem_start, mem_end, mem_type); break; case EFI_PAL_CODE: case EFI_UNUSABLE_MEMORY: case EFI_ACPI_RECLAIM_MEMORY:
add_numamem_region(mem_start, mem_end, mem_type);
fallthrough; case EFI_RESERVED_TYPE: case EFI_RUNTIME_SERVICES_CODE: case EFI_RUNTIME_SERVICES_DATA: case EFI_MEMORY_MAPPED_IO: case EFI_MEMORY_MAPPED_IO_PORT_SPACE:
pr_info("Resvd: mem_type:%d, mem_start:0x%llx, mem_size:0x%llx Bytes\n",
mem_type, mem_start, mem_size); break;
}
}
}
/* * fake_numa_init() - For Non-ACPI systems * Return: 0 on success, -errno on failure.
*/ staticint __init fake_numa_init(void)
{
phys_addr_t start = memblock_start_of_DRAM();
phys_addr_t end = memblock_end_of_DRAM() - 1;
node_set(0, numa_nodes_parsed);
pr_info("Faking a node at [mem %pap-%pap]\n", &start, &end);
return numa_add_memblk(0, start, end + 1);
}
int __init init_numa_memory(void)
{ int i; int ret; int node;
for (i = 0; i < NR_CPUS; i++)
set_cpuid_to_node(i, NUMA_NO_NODE);
Die Informationen auf dieser Webseite wurden
nach bestem Wissen sorgfältig zusammengestellt. Es wird jedoch weder Vollständigkeit, noch Richtigkeit,
noch Qualität der bereit gestellten Informationen zugesichert.
Bemerkung:
Die farbliche Syntaxdarstellung und die Messung sind noch experimentell.