Commit 9a41785c authored by Balbir Singh's avatar Balbir Singh Committed by Ingo Molnar

sched: fix delay accounting regression

Fix the delay accounting regression introduced by commit
75d4ef16. 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: default avatarBalbir Singh <balbir@linux.vnet.ibm.com>
Signed-off-by: default avatarIngo Molnar <mingo@elte.hu>
parent b2be5e96
...@@ -127,7 +127,7 @@ rq_sched_info_depart(struct rq *rq, unsigned long long delta) ...@@ -127,7 +127,7 @@ rq_sched_info_depart(struct rq *rq, unsigned long long delta)
# define schedstat_set(var, val) do { } while (0) # define schedstat_set(var, val) do { } while (0)
#endif #endif
#ifdef CONFIG_SCHEDSTATS #if defined(CONFIG_SCHEDSTATS) || defined(CONFIG_TASK_DELAY_ACCT)
/* /*
* Called when a process is dequeued from the active array and given * Called when a process is dequeued from the active array and given
* the cpu. We should note that with the exception of interactive * the cpu. We should note that with the exception of interactive
...@@ -155,7 +155,7 @@ static inline void sched_info_dequeued(struct task_struct *t) ...@@ -155,7 +155,7 @@ static inline void sched_info_dequeued(struct task_struct *t)
*/ */
static void sched_info_arrive(struct task_struct *t) static void sched_info_arrive(struct task_struct *t)
{ {
unsigned long long now = sched_clock(), delta = 0; unsigned long long now = task_rq(t)->clock, delta = 0;
if (t->sched_info.last_queued) if (t->sched_info.last_queued)
delta = now - t->sched_info.last_queued; delta = now - t->sched_info.last_queued;
...@@ -186,7 +186,7 @@ static inline void sched_info_queued(struct task_struct *t) ...@@ -186,7 +186,7 @@ static inline void sched_info_queued(struct task_struct *t)
{ {
if (unlikely(sched_info_on())) if (unlikely(sched_info_on()))
if (!t->sched_info.last_queued) if (!t->sched_info.last_queued)
t->sched_info.last_queued = sched_clock(); t->sched_info.last_queued = task_rq(t)->clock;
} }
/* /*
...@@ -195,7 +195,8 @@ static inline void sched_info_queued(struct task_struct *t) ...@@ -195,7 +195,8 @@ static inline void sched_info_queued(struct task_struct *t)
*/ */
static inline void sched_info_depart(struct task_struct *t) static inline void sched_info_depart(struct task_struct *t)
{ {
unsigned long long delta = sched_clock() - t->sched_info.last_arrival; unsigned long long delta = task_rq(t)->clock -
t->sched_info.last_arrival;
t->sched_info.cpu_time += delta; t->sched_info.cpu_time += delta;
rq_sched_info_depart(task_rq(t), delta); rq_sched_info_depart(task_rq(t), delta);
...@@ -231,5 +232,5 @@ sched_info_switch(struct task_struct *prev, struct task_struct *next) ...@@ -231,5 +232,5 @@ sched_info_switch(struct task_struct *prev, struct task_struct *next)
#else #else
#define sched_info_queued(t) do { } while (0) #define sched_info_queued(t) do { } while (0)
#define sched_info_switch(t, next) do { } while (0) #define sched_info_switch(t, next) do { } while (0)
#endif /* CONFIG_SCHEDSTATS */ #endif /* CONFIG_SCHEDSTATS || CONFIG_TASK_DELAY_ACCT */
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment