Annoying /proc/net/dev rollovers.

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


The rolling-over of /proc/net/dev fields annoys me.

I read a couple threads about the issue and saw a lot of whimpering
about how locking would be such a pain to implement in lieu of
32-bit atomicity.

Alan Cox pointed out in one of them that accurate info could be
collected through "the firewalling facilities", which I take to mean
the ipt_counters structure. The caveat is that it only provides
packet and byte counts.

One alternative to throwing locks around everything accessing those
fields is to update a 64-bit counter asynchronously. Has this been
considered? It would entail atomically executing

        total_rx_bytes += rx_bytes;
        rx_bytes = 0;

and merely ensuring that rx_bytes does not roll over between calls.
-
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:15 EST