idle 開始時に free_list の状況を表示する

This commit is contained in:
NAKAMURA Gou
2013-07-31 17:33:38 +09:00
parent d4ffe7db8d
commit ec47968a48
3 changed files with 45 additions and 0 deletions

View File

@@ -17,5 +17,6 @@
void *kmalloc(int size, enum ihk_mc_ap_flag flag);
void kfree(void *ptr);
void show_free_list(void);
#endif

View File

@@ -761,3 +761,46 @@ void print_free_list(void)
}
kprintf("\n");
}
void print_active_entry(void)
{
struct cpu_local_var *v = get_this_cpu_local_var();
struct malloc_header *h = &v->free_list;
struct malloc_header *p;
struct malloc_header *q;
kprintf("active entries: \n");
for (p = h->next; (p != h) && (p->next != h) ; p = p->next) {
if (p->size || p->next->size) {
q = p + p->size + 1;
if (q != p->next) {
kprintf(" %p - %p: %d\n", q, p->next, (p->next - q));
}
}
}
kprintf("\n");
return;
}
void show_free_list(void)
{
struct cpu_local_var *v = get_this_cpu_local_var();
struct malloc_header *h = &v->free_list;
struct malloc_header *p;
int count;
int free;
print_active_entry();
count = 0;
free = 0;
for (p = h->next; p != h; p = p->next) {
++count;
free += p->size;
}
kprintf("[%d]free_list: %d entry %lx bytes\n",
ihk_mc_get_processor_id(), count, sizeof(*p)*free);
return;
}

View File

@@ -1911,6 +1911,7 @@ redo:
if ((last != NULL) && (last->status & (PS_ZOMBIE | PS_EXITED))) {
free_process_memory(last);
release_process(last);
show_free_list();
}
}
else {