NUMA: default policy: allocate from CPU's NUMA node

This commit is contained in:
Balazs Gerofi
2016-09-19 23:36:26 +09:00
parent 11125b0d68
commit f39fa54c39
2 changed files with 7 additions and 4 deletions

View File

@ -86,7 +86,8 @@ static void *allocate_aligned_pages(int npages, int p2align,
struct ihk_page_allocator_desc *pa_allocator;
list_for_each_entry(pa_allocator,
&memory_nodes[i].allocators, list) {
&memory_nodes[(ihk_mc_get_numa_id() + i) %
ihk_mc_get_nr_numa_nodes()].allocators, list) {
pa = ihk_pagealloc_alloc(pa_allocator, npages, p2align);
if (pa) break;
@ -94,12 +95,13 @@ static void *allocate_aligned_pages(int npages, int p2align,
if (pa) break;
}
/* all_pagealloc_alloc returns zero when error occured,
and callee (in mcos/kernel/process.c) so propagate it */
if(pa)
if (pa)
return phys_to_virt(pa);
/*
if(flag != IHK_MC_AP_NOWAIT)
panic("Not enough space\n");
*/
return NULL;
}

View File

@ -55,6 +55,7 @@ struct ihk_mc_cpu_info *ihk_mc_get_cpu_info(void);
void ihk_mc_boot_cpu(int cpuid, unsigned long pc);
int ihk_mc_get_processor_id(void);
int ihk_mc_get_hardware_processor_id(void);
int ihk_mc_get_numa_id(void);
void ihk_mc_delay_us(int us);
void ihk_mc_set_syscall_handler(long (*handler)(int, ihk_mc_user_context_t *));