From owner-freebsd-stable@FreeBSD.ORG Thu May 22 02:42:45 2003 Return-Path: Delivered-To: freebsd-stable@freebsd.org Received: from mx1.FreeBSD.org (mx1.freebsd.org [216.136.204.125]) by hub.freebsd.org (Postfix) with ESMTP id 79C7037B401 for ; Thu, 22 May 2003 02:42:45 -0700 (PDT) Received: from dglawrence.com (12-224-163-157.client.attbi.com [12.224.163.157]) by mx1.FreeBSD.org (Postfix) with ESMTP id A00C043FD7 for ; Thu, 22 May 2003 02:42:44 -0700 (PDT) (envelope-from dg@nexus.dglawrence.com) Received: from nexus.dglawrence.com (localhost [127.0.0.1]) by dglawrence.com (8.12.9/8.12.6) with ESMTP id h4M9h6Fu037545 for ; Thu, 22 May 2003 02:43:06 -0700 (PDT) (envelope-from dg@nexus.dglawrence.com) Received: (from dg@localhost) by nexus.dglawrence.com (8.12.9/8.12.3/Submit) id h4M9h66Y037544 for freebsd-stable@freebsd.org; Thu, 22 May 2003 02:43:06 -0700 (PDT) Date: Thu, 22 May 2003 02:43:06 -0700 From: "David G. Lawrence" To: freebsd-stable@freebsd.org Message-ID: <20030522094306.GD60352@nexus.dglawrence.com> References: <20030521104442.G65751@prg.traveller.cz> <20030522092501.GZ10795@imhotep.yuckfou.org> Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20030522092501.GZ10795@imhotep.yuckfou.org> Subject: Re: 4GB limit with netstat X-BeenThere: freebsd-stable@freebsd.org X-Mailman-Version: 2.1.1 Precedence: list List-Id: Production branch of FreeBSD source code List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 22 May 2003 09:42:45 -0000 >To start off, I am not a kernel coder by any means, so what I'm about to say >might sound totally outrageous for various reasons :) > >Wouldn't it be possible to still do the actual counting of packets/bytes in >32b, but keep an additional counter somewhere that simply tracks the number of >times the 32b counter has rolled over? > >The tools that query the counters could then also check how many times the >counter has rolled over and simply add the appropriate number of >bytes/packets to the returned result. Yes, it is possible. On a 32bit architecture machine, we call this sort of thing a 64bit counter. :-) The problem is that another process may be updating the counter at the same time you're reading part of it, causing the result to be potentially inconsistent (e.g. the lower 32bits overflow and the upper 32bit portion hasn't been updated yet when you go to read it. I've forgotten the orginaly discussion last year - just how expensive is it again to do a locked 64bit update on x86? If it is less than say 8x the time to do a 32bit increment, then we should probably just bite the bullet and do it for the few counters where it makes sense (input and output bytes and packets). -DG David G. Lawrence Download Technologies, Inc. - http://www.downloadtech.com - (866) 399 8500 TeraSolutions, Inc. - http://www.terasolutions.com - (888) 346 7175 The FreeBSD Project - http://www.freebsd.org Pave the road of life with opportunities.