Re: [git pull] scheduler fixes

Matthew Wilcox
2008-05-11T11:48:31Z

On Sun, May 11, 2008 at 05:03:06AM -0600, Matthew Wilcox wrote:
> This might be the problem that causes the missing wakeups. If you have a
> semaphore with n=2, and four processes calling down(), tasks A and B
> acquire the semaphore and tasks C and D go to sleep. Task A calls up()
[...]
> Sven, can you try this with your workload? I suspect this might be it
> because XFS does use semaphores with n>1.

This is exactly it. Or rather, it's even simpler. Three tasks
involved; A and B call xlog_state_get_iclog_space() and end up calling
psema(&log->l_flushsema) [down() by any other name -- the semaphore is
initialised to 0; it's really a completion]. Then task C calls
xlog_state_do_callback() which does:

while (flushcnt--)
vsema(&log->l_flushsema);

[vsema is AKA up()]

It assumes this wakes up both A and B ... but it won't with Ingo's code;
it'll wake up A twice.

So I deem my fix "proven by thought experiment". I haven't tried
booting it or anything.

--
Intel are signing my paycheques ... these opinions are still mine
"Bill, look, we understand that you're interested in selling us this
operating system, but compare it to ours. We can't possibly take such
a retrograde step."