Re: [BUG] scheduler doesn't balance thread to idle cpu for 3 seconds

From: Peter Zijlstra
Date: Fri Jan 29 2016 - 05:15:35 EST


On Thu, Jan 28, 2016 at 01:43:13PM -0500, Jan Stancek wrote:
> > How long should I have to wait for a fail?
>
> It's about 1000-2000 iterations for me, which I think you covered
> by now in those 2 hours.

So I've been running:

while ! ./pthread_cond_wait_1 ; do sleep 1; done

overnight on the machine, and have yet to hit a wobbly -- that is, its
still running.

Also note that I don't think failing this test is a bug per se.
Undesirable maybe, but within spec, since SIGALRM is process wide, so it
being delivered to the SCHED_OTHER task is accepted, and SCHED_OTHER has
no timeliness guarantees.

That said; if I could reliably reproduce I'd have a go at fixing this, I
suspect there's a 'fun' problem at the bottom of this.