Andi Kleen wrote:
>
> > BTW, what is the purpose of wake_up_sync()?
>
> wake_up_sync() only wakes up the first process/thread waiting on the
> wait queue. Not all. This is to avoid the 'thundering herd' lock performance
> problem with many waiters when lots of processes get woken up all the time
> just to discover that there is no work for them yet and go to sleep again.
> But it needs careful auditing of the code if it can really tolerate
> wake one.
This was a rhetorical question...
From what I can see and read, wake_up() and wake_up_sync() both wake
up all non-exclusive sleepers and one exclusive sleeper.
The NON _sync versions, OTOH, will call reschedule_idle(), which _may_
cause (if the conditions are favourable) _another_ task to run
on _another_ CPU (SMP), _before_ the wake_up() returns.
This will cause a problem if that other task does IO on xfs
and the code is as it was several days ago.
--
Luben
P.S. This is more or less what had I explained when I was accused
of smoking...
|