]> xenbits.xensource.com Git - people/ssmith/nc2-2.6.27.bak/.git/commitdiff
patch oom-debugging
authorSteven Smith <ssmith@weybridge.uk.xensource.com>
Thu, 28 May 2009 10:54:20 +0000 (11:54 +0100)
committerSteven Smith <ssmith@weybridge.uk.xensource.com>
Thu, 28 May 2009 10:54:20 +0000 (11:54 +0100)
mm/oom_kill.c

index 64e5b4bcd964cd912b5a5f6b22dc392621269d84..b457283cb4db006242fe730e83593376bd917936 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,15 +526,21 @@ 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");
 
+       console_loglevel = orig_log_level;
+
        /*
         * Check if there were limitations on the allocation (only relevant for
         * NUMA) that may require different handling.