move rusage into kernel ELF image (avoid dynamic alloc before NUMA init)
Change-Id: I7fe86244c8707694b379e567b31de65ee2c56887
This commit is contained in:
committed by
Dominique Martinet
parent
4d215de641
commit
60dcd0e798
17
kernel/mem.c
17
kernel/mem.c
@@ -1734,7 +1734,6 @@ void ihk_mc_clean_micpa(void){
|
||||
|
||||
static void rusage_init()
|
||||
{
|
||||
int npages;
|
||||
unsigned long phys;
|
||||
const struct ihk_mc_cpu_info *cpu_info = ihk_mc_get_cpu_info();
|
||||
|
||||
@@ -1742,15 +1741,13 @@ static void rusage_init()
|
||||
panic("rusage_init: PANIC: ihk_mc_get_cpu_info returned NULL");
|
||||
}
|
||||
|
||||
npages = (sizeof(struct rusage_global) + PAGE_SIZE -1) >> PAGE_SHIFT;
|
||||
rusage = ihk_mc_alloc_pages(npages, IHK_MC_AP_CRITICAL);
|
||||
memset(rusage, 0, npages * PAGE_SIZE);
|
||||
rusage->num_processors = cpu_info->ncpus;
|
||||
rusage->num_numa_nodes = ihk_mc_get_nr_numa_nodes();
|
||||
rusage->ns_per_tsc = ihk_mc_get_ns_per_tsc();
|
||||
phys = virt_to_phys(rusage);
|
||||
memset(&rusage, 0, sizeof(rusage));
|
||||
rusage.num_processors = cpu_info->ncpus;
|
||||
rusage.num_numa_nodes = ihk_mc_get_nr_numa_nodes();
|
||||
rusage.ns_per_tsc = ihk_mc_get_ns_per_tsc();
|
||||
phys = virt_to_phys(&rusage);
|
||||
ihk_set_rusage(phys, sizeof(struct rusage_global));
|
||||
dkprintf("%s: rusage->total_memory=%ld\n", __FUNCTION__, rusage->total_memory);
|
||||
dkprintf("%s: rusage.total_memory=%ld\n", __FUNCTION__, rusage.total_memory);
|
||||
}
|
||||
|
||||
extern void monitor_init(void);
|
||||
@@ -1758,7 +1755,7 @@ void mem_init(void)
|
||||
{
|
||||
monitor_init();
|
||||
|
||||
/* It must precedes numa_init() because rusage->total_memory is initialized in numa_init() */
|
||||
/* It must precedes numa_init() because rusage.total_memory is initialized in numa_init() */
|
||||
rusage_init();
|
||||
|
||||
/* Initialize NUMA information and memory allocator bitmaps */
|
||||
|
||||
Reference in New Issue
Block a user