From owner-freebsd-current@FreeBSD.ORG Sun Feb 24 22:46:11 2008 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 C997616A401; Sun, 24 Feb 2008 22:46:11 +0000 (UTC) (envelope-from jroberson@chesapeake.net) Received: from webaccess-cl.virtdom.com (webaccess-cl.virtdom.com [216.240.101.25]) by mx1.freebsd.org (Postfix) with ESMTP id 866CA13C45B; Sun, 24 Feb 2008 22:46:11 +0000 (UTC) (envelope-from jroberson@chesapeake.net) Received: from [192.168.1.107] (cpe-24-94-75-93.hawaii.res.rr.com [24.94.75.93]) (authenticated bits=0) by webaccess-cl.virtdom.com (8.13.6/8.13.6) with ESMTP id m1OMk7rt096574; Sun, 24 Feb 2008 17:46:10 -0500 (EST) (envelope-from jroberson@chesapeake.net) Date: Sun, 24 Feb 2008 12:47:39 -1000 (HST) From: Jeff Roberson X-X-Sender: jroberson@desktop To: Ivan Voras In-Reply-To: Message-ID: <20080224124342.E920@desktop> References: <845250.18624.qm@web63909.mail.re1.yahoo.com> <47BF5702.3020204@FreeBSD.org> <47BF8EB7.9090007@barafranca.com> <47BFB70F.5080402@FreeBSD.org> MIME-Version: 1.0 Content-Type: TEXT/PLAIN; charset=US-ASCII; format=flowed Cc: freebsd-current@freebsd.org Subject: Re: cpu usage in 7.0 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: Sun, 24 Feb 2008 22:46:11 -0000 On Sun, 24 Feb 2008, Ivan Voras wrote: > Kris Kennaway wrote: >> Hugo Silva wrote: >>> Kris Kennaway wrote: >>>> Barney Cordoba wrote: >>>>> I have a dual core system running 7.0 and I can't get >>>>> top to show more than 100% usage no matter how I >>>>> hammer it. My MAC shows over 100% often, but its not >>>>> clear if top is averaging the 2 cpus or just not going >>>>> over 100, or just showing 1 of the cpus. >>>> >>>> 100% in FreeBSD means "all of your CPUs are completely active". It is >>>> hard to exceed this amount :-) >>> >>> You should see my production mysql going over 458% on service startup, on >>> a quad core server :-) >> >> That is a multithreaded process using multiple CPUs, not the total CPU >> statistics (first line of top(1)). > > So how does a multithreaded process get 458% CPU on a quad-core machine? :) > (Really, I want to know; I thought thread CPU accounting was fixed in 7.x. > Unless I'm mistaken, 4 CPU-intensive threads in a single process should > account as 4 CPU-intensive single-thread processes; i.e. each could only take > up to 100% of a core/CPU, accounting for NCPU*100% total). > > It is possible for the sum of all threads in the system to exceed 100% cpu. This is because the decay function is not precise. 15% over is a bit more than I would expect but I suppose it's possible. We also inhert pcpu information from the parent on fork/thread creation so the child isn't created with a priority as if it had been idle. So for a moment the utilization is duplicated. Penalizing the child for an expensive parent is an important optimization that prevents batch jobs from overwhelming the system under load. Thanks, Jeff