From owner-freebsd-current@FreeBSD.ORG Sat Jul 29 16:13:50 2006 Return-Path: X-Original-To: freebsd-current@freebsd.org Delivered-To: freebsd-current@freebsd.org Received: from mx1.FreeBSD.org (mx1.freebsd.org [216.136.204.125]) by hub.freebsd.org (Postfix) with ESMTP id EADD716A4DA for ; Sat, 29 Jul 2006 16:13:50 +0000 (UTC) (envelope-from mime@traveller.cz) Received: from ss.eunet.cz (ss.eunet.cz [193.85.228.13]) by mx1.FreeBSD.org (Postfix) with ESMTP id 50E0643D49 for ; Sat, 29 Jul 2006 16:13:50 +0000 (GMT) (envelope-from mime@traveller.cz) Received: from localhost.i.cz (ss.eunet.cz [193.85.228.13]) by ss.eunet.cz (8.13.6/8.13.6) with ESMTP id k6TGDlt7000431 (version=TLSv1/SSLv3 cipher=RC4-MD5 bits=128 verify=NO); Sat, 29 Jul 2006 18:13:48 +0200 (CEST) (envelope-from mime@traveller.cz) From: Michal Mertl To: Peter Jeremy In-Reply-To: <20060728210154.GC748@turion.vk2pj.dyndns.org> References: <200607251254.k6PCsBef092737@lurza.secnetix.de> <200607271058.13055.jhb@freebsd.org> <20060728121525.GA44917@uk.tiscali.com> <200607280928.36573.jhb@freebsd.org> <20060728134701.GA45273@uk.tiscali.com> <20060728210154.GC748@turion.vk2pj.dyndns.org> Content-Type: text/plain Date: Sat, 29 Jul 2006 18:13:32 +0200 Message-Id: <1154189612.1565.10.camel@genius.i.cz> Mime-Version: 1.0 X-Mailer: Evolution 2.6.2 FreeBSD GNOME Team Port Content-Transfer-Encoding: 7bit Cc: freebsd-current@freebsd.org, Brian Candler Subject: Re: vmstat's entries type 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: Sat, 29 Jul 2006 16:13:51 -0000 Peter Jeremy wrote: > On Fri, 2006-Jul-28 14:47:01 +0100, Brian Candler wrote: > >On Fri, Jul 28, 2006 at 09:28:36AM -0400, John Baldwin wrote: > In a MP configuration where it doesn't particularly matter if a > particular update gets counted this time or next time, I think the > cheapest option is to have per-CPU 32-bit counters (so no locks are > needed to update the counters) with a polling function to accumulate > all the individual counters into a 64-bit total. This pushes the cost > from the update (very frequent) into the read (which is relatively > infrequent), for a lower overall cost. What you describe has already been there for some time. >From sys/sys/pcpu.h #define PCPU_LAZY_INC(var) (++*PCPU_PTR(var)) and function vcnt from sys/vm/vm_meter.c Michal