Merge commit '8700c95adb03' into timers/nohz
[GitHub/mt8127/android_kernel_alcatel_ttab.git] / kernel / events / core.c
index 3820e3cefbaea869541fcdabadb909174f83a42f..6b41c1899a8b00acc0ca48ae30b0e8dfbdd2ad9d 100644 (file)
@@ -18,6 +18,7 @@
 #include <linux/poll.h>
 #include <linux/slab.h>
 #include <linux/hash.h>
+#include <linux/tick.h>
 #include <linux/sysfs.h>
 #include <linux/dcache.h>
 #include <linux/percpu.h>
@@ -685,8 +686,12 @@ static void perf_pmu_rotate_start(struct pmu *pmu)
 
        WARN_ON(!irqs_disabled());
 
-       if (list_empty(&cpuctx->rotation_list))
+       if (list_empty(&cpuctx->rotation_list)) {
+               int was_empty = list_empty(head);
                list_add(&cpuctx->rotation_list, head);
+               if (was_empty)
+                       tick_nohz_full_kick();
+       }
 }
 
 static void get_ctx(struct perf_event_context *ctx)
@@ -2591,6 +2596,16 @@ done:
                list_del_init(&cpuctx->rotation_list);
 }
 
+#ifdef CONFIG_NO_HZ_FULL
+bool perf_event_can_stop_tick(void)
+{
+       if (list_empty(&__get_cpu_var(rotation_list)))
+               return true;
+       else
+               return false;
+}
+#endif
+
 void perf_event_task_tick(void)
 {
        struct list_head *head = &__get_cpu_var(rotation_list);