Merge branch 'i2c/for-current' of git://git.kernel.org/pub/scm/linux/kernel/git/wsa...
[linux-2.6-microblaze.git] / kernel / hung_task.c
index f0f8e2a..751593e 100644 (file)
@@ -43,6 +43,7 @@ unsigned long __read_mostly sysctl_hung_task_timeout_secs = CONFIG_DEFAULT_HUNG_
 int __read_mostly sysctl_hung_task_warnings = 10;
 
 static int __read_mostly did_panic;
+static bool hung_task_show_lock;
 
 static struct task_struct *watchdog_task;
 
@@ -120,12 +121,14 @@ static void check_hung_task(struct task_struct *t, unsigned long timeout)
                pr_err("\"echo 0 > /proc/sys/kernel/hung_task_timeout_secs\""
                        " disables this message.\n");
                sched_show_task(t);
-               debug_show_all_locks();
+               hung_task_show_lock = true;
        }
 
        touch_nmi_watchdog();
 
        if (sysctl_hung_task_panic) {
+               if (hung_task_show_lock)
+                       debug_show_all_locks();
                trigger_all_cpu_backtrace();
                panic("hung_task: blocked tasks");
        }
@@ -172,6 +175,7 @@ static void check_hung_uninterruptible_tasks(unsigned long timeout)
        if (test_taint(TAINT_DIE) || did_panic)
                return;
 
+       hung_task_show_lock = false;
        rcu_read_lock();
        for_each_process_thread(g, t) {
                if (!max_count--)
@@ -187,6 +191,8 @@ static void check_hung_uninterruptible_tasks(unsigned long timeout)
        }
  unlock:
        rcu_read_unlock();
+       if (hung_task_show_lock)
+               debug_show_all_locks();
 }
 
 static long hung_timeout_jiffies(unsigned long last_checked,