4GB limit with netstat

David G. Lawrence dg at dglawrence.com
Thu May 22 02:42:45 PDT 2003


>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.


More information about the freebsd-stable mailing list