From owner-freebsd-current@FreeBSD.ORG Wed Oct 20 01:47:51 2010 Return-Path: Delivered-To: freebsd-current@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 6E874106564A; Wed, 20 Oct 2010 01:47:51 +0000 (UTC) (envelope-from davidxu@freebsd.org) Received: from freefall.freebsd.org (freefall.freebsd.org [IPv6:2001:4f8:fff6::28]) by mx1.freebsd.org (Postfix) with ESMTP id 416C08FC0A; Wed, 20 Oct 2010 01:47:51 +0000 (UTC) Received: from xyf.my.dom (localhost [127.0.0.1]) by freefall.freebsd.org (8.14.4/8.14.4) with ESMTP id o9K1lnZn066806; Wed, 20 Oct 2010 01:47:50 GMT (envelope-from davidxu@freebsd.org) Message-ID: <4CBEBAC5.4030506@freebsd.org> Date: Wed, 20 Oct 2010 09:47:49 +0000 From: David Xu User-Agent: Thunderbird 2.0.0.24 (X11/20100630) MIME-Version: 1.0 To: Jaakko Heinonen References: <4C961009.6080609@freebsd.org> <4C96ED40.7070206@DataIX.net> <4C976F14.8000408@freebsd.org> <4C9789FD.5000008@freebsd.org> <20101019085955.GA4865@jh> In-Reply-To: <20101019085955.GA4865@jh> Content-Type: text/plain; charset=ISO-8859-1; format=flowed Content-Transfer-Encoding: 7bit Cc: freebsd-current@freebsd.org Subject: Re: sysctl -a is slow X-BeenThere: freebsd-current@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: Discussions about the use of FreeBSD-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 20 Oct 2010 01:47:51 -0000 Jaakko Heinonen wrote: > On 2010-09-20, David Xu wrote: >> I redirect all output to a disk file, and it still needs 1 second to >> complete, this machine is dual-core pentium E5500, faster than previous >> one which is a dual-core AMD 5000+ machine, the 5000+ needs 2 >> seconds to complete. >> >> $/usr/bin/time sysctl -b kern.geom.confdot > sysctl_geom_confdot.txt >> 1.00 real 0.00 user 0.00 sys > > I couldn't reproduce the problem myself but I bet that it's a lost > wakeup in g_waitfor_event(). Can you try this patch? > > %%% > Index: sys/geom/geom_event.c > =================================================================== > --- sys/geom/geom_event.c (revision 214048) > +++ sys/geom/geom_event.c (working copy) > @@ -220,11 +220,12 @@ one_event(void) > mtx_lock(&g_eventlock); > TAILQ_REMOVE(&g_events, ep, events); > ep->flag &= ~EV_INPROGRESS; > - mtx_unlock(&g_eventlock); > if (ep->flag & EV_WAKEUP) { > ep->flag |= EV_DONE; > wakeup(ep); > + mtx_unlock(&g_eventlock); > } else { > + mtx_unlock(&g_eventlock); > g_free(ep); > } > g_topology_unlock(); > @@ -365,11 +366,14 @@ g_waitfor_event(g_event_t *func, void *a > va_end(ap); > if (error) > return (error); > - do > - tsleep(ep, PRIBIO, "g_waitfor_event", hz); > - while (!(ep->flag & EV_DONE)); > + > + mtx_lock(&g_eventlock); > + while (!(ep->flag & EV_DONE)) > + msleep(ep, &g_eventlock, PRIBIO, "g_waitfor_event", hz); > if (ep->flag & EV_CANCELED) > error = EAGAIN; > + mtx_unlock(&g_eventlock); > + > g_free(ep); > return (error); > } > %%% > Yes, the patch seems fixed the problem, I can not reproduce it. Thanks!