|
@@ -680,6 +680,26 @@ static u64 sched_vslice(struct cfs_rq *cfs_rq, struct sched_entity *se)
|
|
|
return calc_delta_fair(sched_slice(cfs_rq, se), se);
|
|
|
}
|
|
|
|
|
|
+#ifdef CONFIG_SMP
|
|
|
+static inline void __update_task_entity_contrib(struct sched_entity *se);
|
|
|
+
|
|
|
+/* Give new task start runnable values to heavy its load in infant time */
|
|
|
+void init_task_runnable_average(struct task_struct *p)
|
|
|
+{
|
|
|
+ u32 slice;
|
|
|
+
|
|
|
+ p->se.avg.decay_count = 0;
|
|
|
+ slice = sched_slice(task_cfs_rq(p), &p->se) >> 10;
|
|
|
+ p->se.avg.runnable_avg_sum = slice;
|
|
|
+ p->se.avg.runnable_avg_period = slice;
|
|
|
+ __update_task_entity_contrib(&p->se);
|
|
|
+}
|
|
|
+#else
|
|
|
+void init_task_runnable_average(struct task_struct *p)
|
|
|
+{
|
|
|
+}
|
|
|
+#endif
|
|
|
+
|
|
|
/*
|
|
|
* Update the current task's runtime statistics. Skip current tasks that
|
|
|
* are not in our scheduling class.
|
|
@@ -1527,6 +1547,10 @@ static inline void enqueue_entity_load_avg(struct cfs_rq *cfs_rq,
|
|
|
* We track migrations using entity decay_count <= 0, on a wake-up
|
|
|
* migration we use a negative decay count to track the remote decays
|
|
|
* accumulated while sleeping.
|
|
|
+ *
|
|
|
+ * Newly forked tasks are enqueued with se->avg.decay_count == 0, they
|
|
|
+ * are seen by enqueue_entity_load_avg() as a migration with an already
|
|
|
+ * constructed load_avg_contrib.
|
|
|
*/
|
|
|
if (unlikely(se->avg.decay_count <= 0)) {
|
|
|
se->avg.last_runnable_update = rq_clock_task(rq_of(cfs_rq));
|