diff options
Diffstat (limited to 'kernel/sched.c')
-rw-r--r-- | kernel/sched.c | 12 |
1 files changed, 12 insertions, 0 deletions
diff --git a/kernel/sched.c b/kernel/sched.c index a4aa071f08f3..60b1bbe2ad1b 100644 --- a/kernel/sched.c +++ b/kernel/sched.c | |||
@@ -492,6 +492,7 @@ struct rq { | |||
492 | #define CPU_LOAD_IDX_MAX 5 | 492 | #define CPU_LOAD_IDX_MAX 5 |
493 | unsigned long cpu_load[CPU_LOAD_IDX_MAX]; | 493 | unsigned long cpu_load[CPU_LOAD_IDX_MAX]; |
494 | #ifdef CONFIG_NO_HZ | 494 | #ifdef CONFIG_NO_HZ |
495 | u64 nohz_stamp; | ||
495 | unsigned char in_nohz_recently; | 496 | unsigned char in_nohz_recently; |
496 | #endif | 497 | #endif |
497 | /* capture load from *all* tasks on this cpu: */ | 498 | /* capture load from *all* tasks on this cpu: */ |
@@ -1228,6 +1229,17 @@ void wake_up_idle_cpu(int cpu) | |||
1228 | if (!tsk_is_polling(rq->idle)) | 1229 | if (!tsk_is_polling(rq->idle)) |
1229 | smp_send_reschedule(cpu); | 1230 | smp_send_reschedule(cpu); |
1230 | } | 1231 | } |
1232 | |||
1233 | int nohz_ratelimit(int cpu) | ||
1234 | { | ||
1235 | struct rq *rq = cpu_rq(cpu); | ||
1236 | u64 diff = rq->clock - rq->nohz_stamp; | ||
1237 | |||
1238 | rq->nohz_stamp = rq->clock; | ||
1239 | |||
1240 | return diff < (NSEC_PER_SEC / HZ) >> 1; | ||
1241 | } | ||
1242 | |||
1231 | #endif /* CONFIG_NO_HZ */ | 1243 | #endif /* CONFIG_NO_HZ */ |
1232 | 1244 | ||
1233 | static u64 sched_avg_period(void) | 1245 | static u64 sched_avg_period(void) |