vm, kernel, top: report memory usage of vm, kernel

This commit is contained in:
Ben Gras
2012-09-18 22:19:22 +02:00
parent aa82e375c6
commit fe6e291f59
9 changed files with 69 additions and 15 deletions

View File

@@ -160,6 +160,11 @@ void get_parameters(u32_t ebx, kinfo_t *cbi)
cbi->user_sp &= 0xF0000000;
cbi->user_end = cbi->user_sp;
/* kernel bytes without bootstrap code/data that is currently
* still needed but will be freed after bootstrapping.
*/
kinfo.kernel_allocated_bytes = (phys_bytes) &_kern_size;
assert(!(cbi->bootstrap_start % I386_PAGE_SIZE));
cbi->bootstrap_len = rounddown(cbi->bootstrap_len, I386_PAGE_SIZE);
assert(mbi->flags & MULTIBOOT_INFO_MODS);

View File

@@ -323,6 +323,8 @@ void prot_init()
prot_init_done = 1;
}
static int alloc_for_vm = 0;
void arch_post_init(void)
{
/* Let memory mapping code know what's going on at bootstrap time */
@@ -337,6 +339,7 @@ int libexec_pg_alloc(struct exec_info *execi, off_t vaddr, size_t len)
pg_map(PG_ALLOCATEME, vaddr, vaddr+len, &kinfo);
pg_load();
memset((char *) vaddr, 0, len);
alloc_for_vm += len;
return OK;
}
@@ -383,5 +386,8 @@ void arch_boot_proc(struct boot_image *ip, struct proc *rp)
/* Free VM blob that was just copied into existence. */
cut_memmap(&kinfo, mod->mod_start, mod->mod_end);
/* Remember them */
kinfo.vm_allocated_bytes = alloc_for_vm;
}
}