From owner-freebsd-current@FreeBSD.ORG Wed Jul 19 12:37:27 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 63B3316A4DF for ; Wed, 19 Jul 2006 12:37:27 +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 B246843D46 for ; Wed, 19 Jul 2006 12:37:26 +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 k6JCbOaG088291 (version=TLSv1/SSLv3 cipher=RC4-MD5 bits=128 verify=NO); Wed, 19 Jul 2006 14:37:24 +0200 (CEST) (envelope-from mime@traveller.cz) From: Michal Mertl To: freebsd-current@FreeBSD.ORG In-Reply-To: <200607190750.k6J7olwv037263@lurza.secnetix.de> References: <200607190750.k6J7olwv037263@lurza.secnetix.de> Content-Type: text/plain Date: Wed, 19 Jul 2006 14:37:15 +0200 Message-Id: <1153312635.1261.22.camel@genius.i.cz> Mime-Version: 1.0 X-Mailer: Evolution 2.6.1 FreeBSD GNOME Team Port Content-Transfer-Encoding: 7bit Cc: Oliver Fromme 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: Wed, 19 Jul 2006 12:37:27 -0000 Oliver Fromme wrote: > Michal Mertl wrote: > > Recent thread "2Gb SYSVSHM limitation" reminded me of my recent finding > > - fields in struct vmmeter (src/sys/sys/vmmeter.h) are int and not long. > > I'm not authoritative, but I think they should be neither > int nor long, but uint64_t. No, it won't work, see below. > > On an AMD64 machine which can easily make milion syscalls/second the > > counters seem unnecessarily restricted by being 32bit (u_int). > > You don't need an AMD64 machine for that. I've seen the > counters in the "vmstat -s" output overflow even on slow > (by today's measures) intel machines after a certain amount > of uptime. > > > P.S.: If a commiter expresses some interest in the subject I can work > > out a patch as I just love stats with huge numbers :-). > > Should be fairly easy, I think. The stats are recorded in > sysctl variables (e.g. vm.stats.sys.v_swtch), so you have > to change the data type of the sysctl, then grep the code > for all occurences that access it (kernel as well as user- > land). > > However, there's one small problem: On 32bit architectures > like i386, a 64bit value can't be changed with a single > instruction. That might be an efficiency problem, and you > also might have to make sure that proper locking is used > each time the value is accessed. > We had discussions about 64 bit counters several times during the years (I made a huge patch which turned every network related counter 64bit and all accesses were made with a macro) and the conclusion was that it isn't worth it. 64bit numbers are too expensive to do correctly on 32bit machines. When done incorrectly they can easily get incorrect and that is probably worse than a simple counter in machine's native word size (which can still get incorrect on some architectures). I expect you know that long is usually 64bit wide on 64bit architectures. The discussion about 64bit counters on 32bit machines doesn't make much sense when AMD64 is becoming the mainstream architecture and the right type to use for integers (that can get "large") is long IMHO. > Best regards > Oliver