Commit a206c072 authored by Ingo Molnar's avatar Ingo Molnar

sched: debug: fix cfs_rq->wait_runtime accounting

the cfs_rq->wait_runtime debug/statistics counter was not maintained
properly - fix this.

this also removes some code:

   text    data     bss     dec     hex filename
  13420     228    1204   14852    3a04 sched.o.before
  13404     228    1204   14836    39f4 sched.o.after
Signed-off-by: default avatarIngo Molnar <mingo@elte.hu>
Signed-off-by: default avatarPeter Zijlstra <a.p.zijlstra@chello.nl>
parent a0dc7260
...@@ -858,7 +858,6 @@ static void dec_nr_running(struct task_struct *p, struct rq *rq) ...@@ -858,7 +858,6 @@ static void dec_nr_running(struct task_struct *p, struct rq *rq)
static void set_load_weight(struct task_struct *p) static void set_load_weight(struct task_struct *p)
{ {
task_rq(p)->cfs.wait_runtime -= p->se.wait_runtime;
p->se.wait_runtime = 0; p->se.wait_runtime = 0;
if (task_has_rt_policy(p)) { if (task_has_rt_policy(p)) {
......
...@@ -194,6 +194,8 @@ __enqueue_entity(struct cfs_rq *cfs_rq, struct sched_entity *se) ...@@ -194,6 +194,8 @@ __enqueue_entity(struct cfs_rq *cfs_rq, struct sched_entity *se)
update_load_add(&cfs_rq->load, se->load.weight); update_load_add(&cfs_rq->load, se->load.weight);
cfs_rq->nr_running++; cfs_rq->nr_running++;
se->on_rq = 1; se->on_rq = 1;
schedstat_add(cfs_rq, wait_runtime, se->wait_runtime);
} }
static inline void static inline void
...@@ -205,6 +207,8 @@ __dequeue_entity(struct cfs_rq *cfs_rq, struct sched_entity *se) ...@@ -205,6 +207,8 @@ __dequeue_entity(struct cfs_rq *cfs_rq, struct sched_entity *se)
update_load_sub(&cfs_rq->load, se->load.weight); update_load_sub(&cfs_rq->load, se->load.weight);
cfs_rq->nr_running--; cfs_rq->nr_running--;
se->on_rq = 0; se->on_rq = 0;
schedstat_add(cfs_rq, wait_runtime, -se->wait_runtime);
} }
static inline struct rb_node *first_fair(struct cfs_rq *cfs_rq) static inline struct rb_node *first_fair(struct cfs_rq *cfs_rq)
...@@ -574,7 +578,6 @@ static void __enqueue_sleeper(struct cfs_rq *cfs_rq, struct sched_entity *se) ...@@ -574,7 +578,6 @@ static void __enqueue_sleeper(struct cfs_rq *cfs_rq, struct sched_entity *se)
prev_runtime = se->wait_runtime; prev_runtime = se->wait_runtime;
__add_wait_runtime(cfs_rq, se, delta_fair); __add_wait_runtime(cfs_rq, se, delta_fair);
schedstat_add(cfs_rq, wait_runtime, se->wait_runtime);
delta_fair = se->wait_runtime - prev_runtime; delta_fair = se->wait_runtime - prev_runtime;
/* /*
...@@ -662,7 +665,6 @@ dequeue_entity(struct cfs_rq *cfs_rq, struct sched_entity *se, int sleep) ...@@ -662,7 +665,6 @@ dequeue_entity(struct cfs_rq *cfs_rq, struct sched_entity *se, int sleep)
if (tsk->state & TASK_UNINTERRUPTIBLE) if (tsk->state & TASK_UNINTERRUPTIBLE)
se->block_start = rq_of(cfs_rq)->clock; se->block_start = rq_of(cfs_rq)->clock;
} }
cfs_rq->wait_runtime -= se->wait_runtime;
#endif #endif
} }
__dequeue_entity(cfs_rq, se); __dequeue_entity(cfs_rq, se);
...@@ -1121,10 +1123,8 @@ static void task_new_fair(struct rq *rq, struct task_struct *p) ...@@ -1121,10 +1123,8 @@ static void task_new_fair(struct rq *rq, struct task_struct *p)
* The statistical average of wait_runtime is about * The statistical average of wait_runtime is about
* -granularity/2, so initialize the task with that: * -granularity/2, so initialize the task with that:
*/ */
if (sysctl_sched_features & SCHED_FEAT_START_DEBIT) { if (sysctl_sched_features & SCHED_FEAT_START_DEBIT)
se->wait_runtime = -(sched_granularity(cfs_rq) / 2); se->wait_runtime = -(sched_granularity(cfs_rq) / 2);
schedstat_add(cfs_rq, wait_runtime, se->wait_runtime);
}
__enqueue_entity(cfs_rq, se); __enqueue_entity(cfs_rq, se);
} }
......
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