From owner-freebsd-current@FreeBSD.ORG Mon Sep 20 15:24:27 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 DC8B31065695 for ; Mon, 20 Sep 2010 15:24:26 +0000 (UTC) (envelope-from lstewart@freebsd.org) Received: from lauren.room52.net (lauren.room52.net [210.50.193.198]) by mx1.freebsd.org (Postfix) with ESMTP id 6B2C78FC08 for ; Mon, 20 Sep 2010 15:24:26 +0000 (UTC) Received: from lawrence1.loshell.room52.net (ppp59-167-184-191.static.internode.on.net [59.167.184.191]) by lauren.room52.net (Postfix) with ESMTPSA id 02CC37E853 for ; Tue, 21 Sep 2010 01:24:24 +1000 (EST) Message-ID: <4C977CA8.4040602@freebsd.org> Date: Tue, 21 Sep 2010 01:24:24 +1000 From: Lawrence Stewart User-Agent: Mozilla/5.0 (X11; U; FreeBSD amd64; en-AU; rv:1.9.2.9) Gecko/20100913 Lightning/1.0b2 Thunderbird/3.1.3 MIME-Version: 1.0 To: freebsd-current@freebsd.org References: <4C961009.6080609@freebsd.org> <4C96ED40.7070206@DataIX.net> <4C976F14.8000408@freebsd.org> <4C9789FD.5000008@freebsd.org> <4C9754CD.7000508@freebsd.org> <4C976934.5040501@freebsd.org> In-Reply-To: <4C976934.5040501@freebsd.org> Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: 7bit X-Spam-Status: No, score=0.0 required=5.0 tests=UNPARSEABLE_RELAY autolearn=unavailable version=3.3.1 X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on lauren.room52.net 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: Mon, 20 Sep 2010 15:24:27 -0000 On 09/21/10 00:01, David Xu wrote: > Lawrence Stewart wrote: >> On 09/21/10 02:21, David Xu wrote: >> >>> jhell wrote: >>> >>>> On Mon, 20 Sep 2010 10:26, David Xu wrote: >>>> In Message-Id: <4C976F14.8000408@freebsd.org> >>>> >>>> >>>>> jhell wrote: >>>>> >>>>>> On 09/19/2010 09:28, David Xu wrote: >>>>>> >>>>>>> just typed sysctl -a on keyboard, and found it is slow, sometimes >>>>>>> it has been stuck for a few seconds, further studied,I found it is >>>>>>> stucked at sysctl kern.geom: >>>>>>> >>>>>>> %/usr/bin/time sysctl -a kern.geom >>>>>>> kern.geom.collectstats: 1 >>>>>>> kern.geom.debugflags: 0 >>>>>>> kern.geom.label.debug: 0 >>>>>>> kern.geom.label.ext2fs.enable: 1 >>>>>>> kern.geom.label.iso9660.enable: 1 >>>>>>> kern.geom.label.msdosfs.enable: 1 >>>>>>> kern.geom.label.ntfs.enable: 1 >>>>>>> kern.geom.label.reiserfs.enable: 1 >>>>>>> kern.geom.label.ufs.enable: 1 >>>>>>> kern.geom.label.ufsid.enable: 1 >>>>>>> kern.geom.label.gptid.enable: 1 >>>>>>> kern.geom.label.gpt.enable: 1 >>>>>>> 2.01 real 0.00 user 0.00 sys >>>>>>> >>>>>>> it seems it needs more than 2 seconds to complete. >>>>>>> >>>>>>> >>>>>> A ktrace(1) and a kdump(1) of the resulting ktrace.out file would >>>>>> probably help here along with uname -a. Ive seen this happen once >>>>>> before >>>>>> but do not recall what caused it. >>>>>> >>>>>> >>>>>> Regards & good luck, >>>>>> >>>>>> >>>>> Result is dumped here. >>>>> http://people.freebsd.org/~davidxu/sysctl_slow.txt >>>>> I think the culprit is sysctl kern.geom.confdot, >>>>> which does not appear in normal output, until I check the kdump >>>>> result. >>>>> I tried five times, and it was blocked three times. >>>>> >>>>> >>>> Inspecting the output of sysctl -b kern.geom.confdot will give you >>>> what you currently have configured in the system as disks and what not >>>> through geom. If this seems to be bailing at that point, which is an >>>> opaque MIB/OID which doesn't come up other than when you use the "-o" >>>> switch to sysctl(1) then could you check your labels for your disks >>>> for any weird characters in the labels ? >>>> >>>> ( sysctl -bo kern.geom ) >>>> >>>> Also does this have the same effect when run in a xterm, cons25 >>>> terminal ? >>>> >>>> And same for the above but with the C, *_COUNTRY.UTF-8 or your normal >>>> locale ? >>>> >>>> ( env LANG=C sysctl kern.geom ) >>>> >>>> Looking at the output from mine there are quite a few unprintable >>>> characters present. Maybe these are having an impact with one of your >>>> labels. >>>> >>>> >>>> >>> 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 >>> >>> the file is here: >>> http://people.freebsd.org/~davidxu/sysctl_geom_confdot.txt >>> >> >> As an extra data point, running "/usr/bin/time sysctl -b >> kern.geom.confdot" repeatedly on my amd64 8.1-STABLE desktop varies >> between 0s and 2s. It reports 0 majority of the time but every 5 or so >> runs it'll stall for 1 or 2 seconds. So the problem isn't isolated to >> head. >> >> Cheers, >> Lawrence >> > > I happened to set kern.sched.preempt_thresh=200, so the kernel is more > aggressive > than default on thread preemption. it is easier than default to > reproduce the > problem, my desktop machine is idle, but it still stalls 1 or 2 > seconds on the sysctl. heh, from /etc/sysctl.conf on the machine I tested with: # 4/9/2010 # should give more responsiveness on desktop suggested # by David Xu on freebsd-stable@ kern.sched.preempt_thresh=220 This machine is my primary kde4 desktop at home. Cheers, Lawrence