From: t_jeang Date: Tue, 6 Jan 2009 12:06:06 +0000 (+0000) Subject: imported patch oom-debugging X-Git-Tag: dom0-swap-extra-debugging X-Git-Url: http://xenbits.xensource.com/gitweb?a=commitdiff_plain;h=6fce8182b9210a21f9c9e3a543bc9126c2047136;p=xenclient%2Fkernel.git imported patch oom-debugging --- diff --git a/mm/oom_kill.c b/mm/oom_kill.c index b4643dd3..54ffd8bc 100644 --- a/mm/oom_kill.c +++ b/mm/oom_kill.c @@ -25,7 +25,7 @@ #include int sysctl_panic_on_oom; -/* #define DEBUG */ +#define DEBUG /** * badness - calculate a numeric value for how bad this task has been @@ -153,7 +153,7 @@ unsigned long badness(struct task_struct *p, unsigned long uptime) } #ifdef DEBUG - printk(KERN_DEBUG "OOMkill: task %d (%s) got %d points\n", + printk(KERN_INFO "OOMkill: task %d (%s) got %ld points\n", p->pid, p->comm, points); #endif return points; @@ -448,6 +448,7 @@ void out_of_memory(struct zonelist *zonelist, gfp_t gfp_mask, int order, int for struct task_struct *p; unsigned long points = 0; unsigned long freed = 0; + int orig_log_level; blocking_notifier_call_chain(&oom_notify_list, 0, &freed); if (freed > 0) @@ -457,6 +458,9 @@ void out_of_memory(struct zonelist *zonelist, gfp_t gfp_mask, int order, int for if (!should_oom_kill() && !force) return; + orig_log_level = console_loglevel; + console_loglevel = 7; + if (printk_ratelimit()) { printk(KERN_WARNING "%s invoked oom-killer: " "gfp_mask=0x%x, order=%d, oomkilladj=%d\n", @@ -513,6 +517,8 @@ out: read_unlock(&tasklist_lock); cpuset_unlock(); + console_loglevel = orig_log_level; + /* * Give "p" a good chance of killing itself before we * retry to allocate memory unless "p" is current