sched: fix delay accounting regression

Fix the delay accounting regression introduced by commit
75d4ef16a6aa84f708188bada182315f80aab6fa. rq no longer has sched_info
data associated with it. task_struct sched_info structure is used by delay
accounting to provide back statistics to user space.

also remove direct use of sched_clock() (which is not a valid thing to
do anymore) and use rq->clock instead.

Signed-off-by: Balbir Singh <balbir@linux.vnet.ibm.com>
Signed-off-by: Ingo Molnar <mingo@elte.hu>

authored by Balbir Singh and committed by Ingo Molnar 9a41785c b2be5e96

+6 -5
+6 -5
kernel/sched_stats.h
··· 127 # define schedstat_set(var, val) do { } while (0) 128 #endif 129 130 - #ifdef CONFIG_SCHEDSTATS 131 /* 132 * Called when a process is dequeued from the active array and given 133 * the cpu. We should note that with the exception of interactive ··· 155 */ 156 static void sched_info_arrive(struct task_struct *t) 157 { 158 - unsigned long long now = sched_clock(), delta = 0; 159 160 if (t->sched_info.last_queued) 161 delta = now - t->sched_info.last_queued; ··· 186 { 187 if (unlikely(sched_info_on())) 188 if (!t->sched_info.last_queued) 189 - t->sched_info.last_queued = sched_clock(); 190 } 191 192 /* ··· 195 */ 196 static inline void sched_info_depart(struct task_struct *t) 197 { 198 - unsigned long long delta = sched_clock() - t->sched_info.last_arrival; 199 200 t->sched_info.cpu_time += delta; 201 rq_sched_info_depart(task_rq(t), delta); ··· 232 #else 233 #define sched_info_queued(t) do { } while (0) 234 #define sched_info_switch(t, next) do { } while (0) 235 - #endif /* CONFIG_SCHEDSTATS */ 236
··· 127 # define schedstat_set(var, val) do { } while (0) 128 #endif 129 130 + #if defined(CONFIG_SCHEDSTATS) || defined(CONFIG_TASK_DELAY_ACCT) 131 /* 132 * Called when a process is dequeued from the active array and given 133 * the cpu. We should note that with the exception of interactive ··· 155 */ 156 static void sched_info_arrive(struct task_struct *t) 157 { 158 + unsigned long long now = task_rq(t)->clock, delta = 0; 159 160 if (t->sched_info.last_queued) 161 delta = now - t->sched_info.last_queued; ··· 186 { 187 if (unlikely(sched_info_on())) 188 if (!t->sched_info.last_queued) 189 + t->sched_info.last_queued = task_rq(t)->clock; 190 } 191 192 /* ··· 195 */ 196 static inline void sched_info_depart(struct task_struct *t) 197 { 198 + unsigned long long delta = task_rq(t)->clock - 199 + t->sched_info.last_arrival; 200 201 t->sched_info.cpu_time += delta; 202 rq_sched_info_depart(task_rq(t), delta); ··· 231 #else 232 #define sched_info_queued(t) do { } while (0) 233 #define sched_info_switch(t, next) do { } while (0) 234 + #endif /* CONFIG_SCHEDSTATS || CONFIG_TASK_DELAY_ACCT */ 235