|
@@ -492,6 +492,7 @@ struct rq {
|
|
|
#define CPU_LOAD_IDX_MAX 5
|
|
|
unsigned long cpu_load[CPU_LOAD_IDX_MAX];
|
|
|
#ifdef CONFIG_NO_HZ
|
|
|
+ u64 nohz_stamp;
|
|
|
unsigned char in_nohz_recently;
|
|
|
#endif
|
|
|
/* capture load from *all* tasks on this cpu: */
|
|
@@ -1228,6 +1229,17 @@ void wake_up_idle_cpu(int cpu)
|
|
|
if (!tsk_is_polling(rq->idle))
|
|
|
smp_send_reschedule(cpu);
|
|
|
}
|
|
|
+
|
|
|
+int nohz_ratelimit(int cpu)
|
|
|
+{
|
|
|
+ struct rq *rq = cpu_rq(cpu);
|
|
|
+ u64 diff = rq->clock - rq->nohz_stamp;
|
|
|
+
|
|
|
+ rq->nohz_stamp = rq->clock;
|
|
|
+
|
|
|
+ return diff < (NSEC_PER_SEC / HZ) >> 1;
|
|
|
+}
|
|
|
+
|
|
|
#endif /* CONFIG_NO_HZ */
|
|
|
|
|
|
static u64 sched_avg_period(void)
|