From owner-freebsd-geom@FreeBSD.ORG Fri Oct 22 09:56:59 2010 Return-Path: Delivered-To: freebsd-geom@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 475081065694 for ; Fri, 22 Oct 2010 09:56:59 +0000 (UTC) (envelope-from gcubfg-freebsd-geom@m.gmane.org) Received: from lo.gmane.org (lo.gmane.org [80.91.229.12]) by mx1.freebsd.org (Postfix) with ESMTP id F25488FC08 for ; Fri, 22 Oct 2010 09:56:58 +0000 (UTC) Received: from list by lo.gmane.org with local (Exim 4.69) (envelope-from ) id 1P9EMs-00045B-1s for freebsd-geom@freebsd.org; Fri, 22 Oct 2010 11:56:58 +0200 Received: from lara.cc.fer.hr ([161.53.72.113]) by main.gmane.org with esmtp (Gmexim 0.1 (Debian)) id 1AlnuQ-0007hv-00 for ; Fri, 22 Oct 2010 11:56:58 +0200 Received: from ivoras by lara.cc.fer.hr with local (Gmexim 0.1 (Debian)) id 1AlnuQ-0007hv-00 for ; Fri, 22 Oct 2010 11:56:58 +0200 X-Injected-Via-Gmane: http://gmane.org/ To: freebsd-geom@freebsd.org From: Ivan Voras Date: Fri, 22 Oct 2010 11:56:53 +0200 Lines: 20 Message-ID: References: <4C4ED619.7050305@FreeBSD.org> <27237.1280241532@critter.freebsd.dk> <4C4F171C.9010106@FreeBSD.org> <20101021174301.GA1381@a91-153-123-205.elisa-laajakaista.fi> Mime-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 7bit X-Complaints-To: usenet@dough.gmane.org X-Gmane-NNTP-Posting-Host: lara.cc.fer.hr User-Agent: Mozilla/5.0 (X11; U; FreeBSD amd64; en-US; rv:1.9.1.12) Gecko/20101018 Thunderbird/3.0.8 In-Reply-To: <20101021174301.GA1381@a91-153-123-205.elisa-laajakaista.fi> X-Enigmail-Version: 1.0.1 Subject: Re: Hyperactive g_event thread X-BeenThere: freebsd-geom@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: GEOM-specific discussions and implementations List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 22 Oct 2010 09:56:59 -0000 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.