mm/migrate: correct failure handling if !hugepage_migration_support()
[firefly-linux-kernel-4.4.55.git] / kernel / sched / clock.c
index c9b34c4e3ecc16c3d9008fa4d793647f2ad1047a..6bd6a6731b21220cae9c9691583c59d9c992ff6f 100644 (file)
@@ -59,6 +59,7 @@
 #include <linux/ktime.h>
 #include <linux/sched.h>
 #include <linux/static_key.h>
+#include <linux/workqueue.h>
 
 /*
  * Scheduler clock - returns current time in nanosec units.
@@ -90,13 +91,23 @@ void set_sched_clock_stable(void)
                static_key_slow_dec(&__sched_clock_stable);
 }
 
-void clear_sched_clock_stable(void)
+static void __clear_sched_clock_stable(struct work_struct *work)
 {
        /* XXX worry about clock continuity */
        if (sched_clock_stable())
                static_key_slow_inc(&__sched_clock_stable);
 }
 
+static DECLARE_WORK(sched_clock_work, __clear_sched_clock_stable);
+
+void clear_sched_clock_stable(void)
+{
+       if (keventd_up())
+               schedule_work(&sched_clock_work);
+       else
+               __clear_sched_clock_stable(&sched_clock_work);
+}
+
 struct sched_clock_data {
        u64                     tick_raw;
        u64                     tick_gtod;