diff options
-rw-r--r-- | include/linux/sched.h | 6 | ||||
-rw-r--r-- | kernel/sched/core.c | 18 |
2 files changed, 24 insertions, 0 deletions
diff --git a/include/linux/sched.h b/include/linux/sched.h index 1ff9e0a5de27..a74adedcdd10 100644 --- a/include/linux/sched.h +++ b/include/linux/sched.h | |||
@@ -1856,6 +1856,12 @@ extern void wake_up_nohz_cpu(int cpu); | |||
1856 | static inline void wake_up_nohz_cpu(int cpu) { } | 1856 | static inline void wake_up_nohz_cpu(int cpu) { } |
1857 | #endif | 1857 | #endif |
1858 | 1858 | ||
1859 | #ifdef CONFIG_NO_HZ_FULL | ||
1860 | extern bool sched_can_stop_tick(void); | ||
1861 | #else | ||
1862 | static inline bool sched_can_stop_tick(void) { return false; } | ||
1863 | #endif | ||
1864 | |||
1859 | #ifdef CONFIG_SCHED_AUTOGROUP | 1865 | #ifdef CONFIG_SCHED_AUTOGROUP |
1860 | extern void sched_autogroup_create_attach(struct task_struct *p); | 1866 | extern void sched_autogroup_create_attach(struct task_struct *p); |
1861 | extern void sched_autogroup_detach(struct task_struct *p); | 1867 | extern void sched_autogroup_detach(struct task_struct *p); |
diff --git a/kernel/sched/core.c b/kernel/sched/core.c index 0f0a5b3fd62c..69f71335984f 100644 --- a/kernel/sched/core.c +++ b/kernel/sched/core.c | |||
@@ -650,6 +650,24 @@ static inline bool got_nohz_idle_kick(void) | |||
650 | 650 | ||
651 | #endif /* CONFIG_NO_HZ_COMMON */ | 651 | #endif /* CONFIG_NO_HZ_COMMON */ |
652 | 652 | ||
653 | #ifdef CONFIG_NO_HZ_FULL | ||
654 | bool sched_can_stop_tick(void) | ||
655 | { | ||
656 | struct rq *rq; | ||
657 | |||
658 | rq = this_rq(); | ||
659 | |||
660 | /* Make sure rq->nr_running update is visible after the IPI */ | ||
661 | smp_rmb(); | ||
662 | |||
663 | /* More than one running task need preemption */ | ||
664 | if (rq->nr_running > 1) | ||
665 | return false; | ||
666 | |||
667 | return true; | ||
668 | } | ||
669 | #endif /* CONFIG_NO_HZ_FULL */ | ||
670 | |||
653 | void sched_avg_update(struct rq *rq) | 671 | void sched_avg_update(struct rq *rq) |
654 | { | 672 | { |
655 | s64 period = sched_avg_period(); | 673 | s64 period = sched_avg_period(); |