]> xenbits.xensource.com Git - people/ssmith/nc2-2.6.27.git/commitdiff
patch oom-debugging
authorSteven Smith <ssmith@weybridge.uk.xensource.com>
Tue, 30 Jun 2009 11:55:48 +0000 (12:55 +0100)
committerSteven Smith <ssmith@weybridge.uk.xensource.com>
Tue, 30 Jun 2009 11:55:48 +0000 (12:55 +0100)
mm/oom_kill.c

index 64e5b4bcd964cd912b5a5f6b22dc392621269d84..2708392a253e64f4b9e14e47d5a322148093337a 100644 (file)
@@ -32,7 +32,7 @@ int sysctl_panic_on_oom;
 int sysctl_oom_kill_allocating_task;
 int sysctl_oom_dump_tasks;
 static DEFINE_SPINLOCK(zone_scan_mutex);
-/* #define DEBUG */
+#define DEBUG
 
 /**
  * badness - calculate a numeric value for how bad this task has been
@@ -163,7 +163,7 @@ unsigned long badness(struct task_struct *p, unsigned long uptime)
        }
 
 #ifdef DEBUG
-       printk(KERN_DEBUG "OOMkill: task %d (%s) got %lu points\n",
+       printk(KERN_INFO "OOMkill: task %d (%s) got %lu points\n",
        p->pid, p->comm, points);
 #endif
        return points;
@@ -424,6 +424,7 @@ void mem_cgroup_out_of_memory(struct mem_cgroup *mem, gfp_t gfp_mask)
 {
        unsigned long points = 0;
        struct task_struct *p;
+       int orig_log_level;
 
        cgroup_lock();
        read_lock(&tasklist_lock);
@@ -525,12 +526,16 @@ void out_of_memory(struct zonelist *zonelist, gfp_t gfp_mask, int order)
        unsigned long points = 0;
        unsigned long freed = 0;
        enum oom_constraint constraint;
+       int orig_log_level;
 
        blocking_notifier_call_chain(&oom_notify_list, 0, &freed);
        if (freed > 0)
                /* Got some memory back in the last second. */
                return;
 
+       orig_log_level = console_loglevel;
+       console_loglevel = 7;
+
        if (sysctl_panic_on_oom == 2)
                panic("out of memory. Compulsory panic_on_oom is selected.\n");
 
@@ -583,6 +588,8 @@ retry:
 out:
        read_unlock(&tasklist_lock);
 
+       console_loglevel = orig_log_level;
+
        /*
         * Give "p" a good chance of killing itself before we
         * retry to allocate memory unless "p" is current