Bug 469 - /proc/net/dev byte counter wraps after 2^32
/proc/net/dev byte counter wraps after 2^32
Status: REJECTED WILL_NOT_FIX
Product: Networking
Classification: Unclassified
Component: Other
i386 Linux
: P2 low
Assigned To: Jeff Sipek
:
: 7069 (view as bug list)
Depends on:
Blocks:
  Show dependency treegraph
 
Reported: 2003-03-18 07:51 UTC by Burton Windle
Modified: 2006-08-29 08:01 UTC (History)
3 users (show)

See Also:
Kernel Version:
Tree: Mainline
Regression: ---


Attachments
Linux 2.6.9 64-bit net counters (3.55 KB, patch)
2004-11-19 15:25 UTC, Peter Kovář
Details | Diff
Linux 2.4.27 64-bit net counters (3.44 KB, patch)
2004-11-19 15:27 UTC, Peter Kovář
Details | Diff

Description Burton Windle 2003-03-18 07:51:21 UTC
Distribution: Debian Testing
Hardware Environment: Pentium2
Software Environment: tbench
Problem Description:
The 'bytes' counter in /proc/net/dev wraps after bytes > 2^32. I assume this is 
a 32-bit processor limitation. How about /proc/net/dev count in kilobytes 
instead of bytes? Granted, this would break userspace, but in the age of 500gb 
NFS shares and multi-terrabyte RAID arrays, having a network counter that can 
only go up to 4gb before wrapping needs a fix.

Steps to reproduce:
fire up tbench, using 50 clients, and wait about 5 minutes, 
cat'ing /proc/net/dev the whole time.
Comment 1 Jeff Sipek 2003-07-17 22:44:24 UTC
There were couple of (relatively) short discussions on linux-kernel, and for now
the verdict is "Do it in user space" --Linus.

Note: The counters overflow every 2^32 bytes only on 32-bit architectures,
64-bit architectures handle the counters as 64-bits.
Comment 2 Peter Kovář 2004-11-19 15:25:02 UTC
Created attachment 4090 [details]
Linux 2.6.9 64-bit net counters

This patch avoids wraps after 4 GiB also on 32-bit anarchitectures.

Peter Kov
Comment 3 Peter Kovář 2004-11-19 15:27:14 UTC
Created attachment 4091 [details]
Linux 2.4.27 64-bit net counters

This patch avoids wraps after 4 GiB also on 32-bit anarchitectures.

Peter Kov
Comment 4 Jeff Sipek 2004-11-27 10:34:40 UTC
It is not that easy. 64-bit operations are not atomic on 32-bit architectures.

My implementation of a patch to solve it is on my website
http://shells.gnugeneration.com/~jeffpc/.

Jeff.
Comment 5 Daniel Drake 2005-09-17 09:57:38 UTC
Downstream bug report: http://bugs.gentoo.org/show_bug.cgi?id=67614
Comment 6 Nishanth Aravamudan 2006-05-10 11:59:15 UTC
I just tried cat /proc/net/dev on my 2.6.17-rc2 x86_64 kernel. My eth0 rx bytes
value: 15847163310; my eth0 tx bytes value: 11484555682. Both are larger than
2^32. I'm willing to say that the Gentoo report is invalid and close the bug.
32-bit kernels will be restricted to 32-bit values and 64-bit kernels will be
restricted to 64-bit values. If you want better parsing, then, as Linus said,
make a userspace tool handle it.

Anyone have a problem with the bug being closed?
Comment 7 Daniel Drake 2006-05-21 12:25:17 UTC
No responses, closing bug. Yes, it is possible that the downstream bug was
invalid, since there is no hard evidence there.
Comment 8 Diego Calleja 2006-08-29 08:01:12 UTC
*** Bug 7069 has been marked as a duplicate of this bug. ***

Note You need to log in before you can comment on or make changes to this bug.