Re: Annoying /proc/net/dev rollovers.

From: Mark J Roberts (mjr@znex.org)
Date: Sun Feb 16 2003 - 21:46:05 EST


Chris Wedgwood:
> How often does it happen?

When the windows box behind my NAT is using all of my 640kbit/sec
downstream to download movies, it takes a little over 14 hours to
download four gigabytes and roll over the byte counter. This means
ifconfig is mostly useless for getting an idea of how much I've
downloaded, which is something very useful to me.

> > total_rx_bytes += rx_bytes;
>
> if lval is 64-bit, then this cannot be done reliably on all
> architectures

I'm not sure why. I realize that x86 can't do atomic 64-bit
operations, but what I propose is to leave the 32-bit rx_bytes code
the way it is, and just have some heuristic for updating the 64-bit
value every so often, which can be done under a lock, so there would
be no opportunity for races to corrupt the counter. (This is also an
optimization since there needn't be any locks in the actual packet
handling code.)

But I admit I'm no expert programmer, and I might be suggesting
nonsense. In any case, the bug is real, the ifconfig output is
misleading, and I think it should be fixed one way or another.
-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/



This archive was generated by hypermail 2b29 : Sun Feb 23 2003 - 22:00:16 EST