Date: Thu, 22 May 2003 02:43:06 -0700 From: "David G. Lawrence" <dg@dglawrence.com> To: freebsd-stable@freebsd.org Subject: Re: 4GB limit with netstat Message-ID: <20030522094306.GD60352@nexus.dglawrence.com> In-Reply-To: <20030522092501.GZ10795@imhotep.yuckfou.org> References: <20030521104442.G65751@prg.traveller.cz> <20030522092501.GZ10795@imhotep.yuckfou.org>
next in thread | previous in thread | raw e-mail | index | archive | help
>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.
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?20030522094306.GD60352>