NUMA: default policy: allocate from CPU's NUMA node
This commit is contained in:
10
kernel/mem.c
10
kernel/mem.c
@@ -86,7 +86,8 @@ static void *allocate_aligned_pages(int npages, int p2align,
|
|||||||
struct ihk_page_allocator_desc *pa_allocator;
|
struct ihk_page_allocator_desc *pa_allocator;
|
||||||
|
|
||||||
list_for_each_entry(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);
|
pa = ihk_pagealloc_alloc(pa_allocator, npages, p2align);
|
||||||
|
|
||||||
if (pa) break;
|
if (pa) break;
|
||||||
@@ -94,12 +95,13 @@ static void *allocate_aligned_pages(int npages, int p2align,
|
|||||||
|
|
||||||
if (pa) break;
|
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);
|
return phys_to_virt(pa);
|
||||||
|
/*
|
||||||
if(flag != IHK_MC_AP_NOWAIT)
|
if(flag != IHK_MC_AP_NOWAIT)
|
||||||
panic("Not enough space\n");
|
panic("Not enough space\n");
|
||||||
|
*/
|
||||||
return NULL;
|
return NULL;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -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);
|
void ihk_mc_boot_cpu(int cpuid, unsigned long pc);
|
||||||
int ihk_mc_get_processor_id(void);
|
int ihk_mc_get_processor_id(void);
|
||||||
int ihk_mc_get_hardware_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_delay_us(int us);
|
||||||
void ihk_mc_set_syscall_handler(long (*handler)(int, ihk_mc_user_context_t *));
|
void ihk_mc_set_syscall_handler(long (*handler)(int, ihk_mc_user_context_t *));
|
||||||
|
|||||||
Reference in New Issue
Block a user