drm/mgag200: fix typo causing bw limits to be ignored on some chips
[firefly-linux-kernel-4.4.55.git] / kernel / hung_task.c
index 3e97fb126e6b9255a852887923f39230cd52c513..0b9c169d577f967ab04750d32d2639a5e7d2bc6f 100644 (file)
 #include <linux/export.h>
 #include <linux/sysctl.h>
 #include <linux/utsname.h>
+#include <trace/events/sched.h>
 
 /*
  * The number of tasks checked:
  */
-unsigned long __read_mostly sysctl_hung_task_check_count = PID_MAX_LIMIT;
+int __read_mostly sysctl_hung_task_check_count = PID_MAX_LIMIT;
 
 /*
  * Limit number of tasks checked in a batch.
@@ -36,7 +37,7 @@ unsigned long __read_mostly sysctl_hung_task_check_count = PID_MAX_LIMIT;
  */
 unsigned long __read_mostly sysctl_hung_task_timeout_secs = CONFIG_DEFAULT_HUNG_TASK_TIMEOUT;
 
-unsigned long __read_mostly sysctl_hung_task_warnings = 10;
+int __read_mostly sysctl_hung_task_warnings = 10;
 
 static int __read_mostly did_panic;
 
@@ -92,9 +93,14 @@ static void check_hung_task(struct task_struct *t, unsigned long timeout)
                t->last_switch_count = switch_count;
                return;
        }
+
+       trace_sched_process_hang(t);
+
        if (!sysctl_hung_task_warnings)
                return;
-       sysctl_hung_task_warnings--;
+
+       if (sysctl_hung_task_warnings > 0)
+               sysctl_hung_task_warnings--;
 
        /*
         * Ok, the task did not get scheduled for more than 2 minutes,
@@ -203,6 +209,14 @@ int proc_dohung_task_timeout_secs(struct ctl_table *table, int write,
        return ret;
 }
 
+static atomic_t reset_hung_task = ATOMIC_INIT(0);
+
+void reset_hung_task_detector(void)
+{
+       atomic_set(&reset_hung_task, 1);
+}
+EXPORT_SYMBOL_GPL(reset_hung_task_detector);
+
 /*
  * kthread which checks for tasks stuck in D state
  */
@@ -216,6 +230,9 @@ static int watchdog(void *dummy)
                while (schedule_timeout_interruptible(timeout_jiffies(timeout)))
                        timeout = sysctl_hung_task_timeout_secs;
 
+               if (atomic_xchg(&reset_hung_task, 0))
+                       continue;
+
                check_hung_uninterruptible_tasks(timeout);
        }