Skip site navigation (1)Skip section navigation (2)
Date:      Fri, 22 Oct 2010 11:56:53 +0200
From:      Ivan Voras <ivoras@freebsd.org>
To:        freebsd-geom@freebsd.org
Subject:   Re: Hyperactive g_event thread
Message-ID:  <i9rn51$ec0$1@dough.gmane.org>
In-Reply-To: <20101021174301.GA1381@a91-153-123-205.elisa-laajakaista.fi>
References:  <4C4ED619.7050305@FreeBSD.org>	<27237.1280241532@critter.freebsd.dk>	<AANLkTi=uRPV2T0=t_1s=Jc4PmBtai=__HqhCtYpiDdTQ@mail.gmail.com>	<AANLkTikvV4oymBBA%2B_0zbzd_edS8dRfqqJRODE0989%2Bn@mail.gmail.com>	<4C4F171C.9010106@FreeBSD.org> <20101021174301.GA1381@a91-153-123-205.elisa-laajakaista.fi>

index | next in thread | previous in thread | raw e-mail

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.



help

Want to link to this message? Use this
URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?i9rn51$ec0$1>