Re: [PATCH v4] sched: fix incorrect wait time and wait count statistics

From: Peter Zijlstra
Date: Mon Nov 09 2015 - 05:32:35 EST


On Fri, Nov 06, 2015 at 06:41:43PM -0800, Joonwoo Park wrote:
> On Fri, Nov 06, 2015 at 02:57:49PM +0100, Peter Zijlstra wrote:
> > On Tue, Oct 27, 2015 at 09:46:53PM -0700, Joonwoo Park wrote:
> > > @@ -1272,6 +1272,15 @@ void set_task_cpu(struct task_struct *p, unsigned int new_cpu)
> > > WARN_ON_ONCE(p->state != TASK_RUNNING && p->state != TASK_WAKING &&
> > > !p->on_rq);
> > >
> > > + /*
> > > + * Migrating fair class task must have p->on_rq = TASK_ON_RQ_MIGRATING,
> > > + * because schedstat_wait_{start,end} rebase migrating task's wait_start
> > > + * time relying on p->on_rq.
> > > + */
> > > + WARN_ON_ONCE(p->state == TASK_RUNNING &&
> > > + p->sched_class == &fair_sched_class &&
> > > + (p->on_rq && !task_on_rq_migrating(p)));
> > > +
> >
> > Why do we have to test p->on_rq? Would not ->state == RUNNING imply
> > that?
> >
>
> sched_fork() sets p->state = RUNNING before changing task cpu.
> Please let me know if you got better idea.

Ah, indeed. OK.
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/