Hyperactive g_event thread

Ivan Voras ivoras at freebsd.org
Fri Oct 22 09:56:59 UTC 2010


On 10/21/10 19:43, Jaakko Heinonen wrote:

> I drafted a patch to use g_eventlock instead to protect against losing
> wakeups:
> 
> 	http://people.freebsd.org/~jh/patches/geom-eventproc-sleep.diff
> 
> Reviews and/or testing will be welcomed.


Isn't this sequence:

-	mtx_unlock(&g_eventlock);
 	wakeup(&g_wait_event);
+	mtx_unlock(&g_eventlock);

too racy? It is possible, especially if something changes in scheduling
or the wakeup() implementation, and on single-CPU machines, that the
woken thread could run and then encounter the lock not yet released,
leading to more lock waiting.



More information about the freebsd-geom mailing list