[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <1281615375.2494.20.camel@edumazet-laptop>
Date: Thu, 12 Aug 2010 14:16:15 +0200
From: Eric Dumazet <eric.dumazet@...il.com>
To: Andrew Morton <akpm@...ux-foundation.org>
Cc: David Miller <davem@...emloft.net>,
Stephen Hemminger <shemminger@...ux-foundation.org>,
netdev@...r.kernel.org, bhutchings@...arflare.com,
Nick Piggin <npiggin@...e.de>
Subject: Re: [PATCH net-next-2.6] bridge: 64bit rx/tx counters
Le lundi 09 août 2010 à 21:47 -0700, Andrew Morton a écrit :
> Oh for fuck's sake. Will you guys just stop adding generic kernel
> infrastructure behind everyone's backs?
>
> Had I actually been aware that this stuff was going into the tree I'd
> have pointed out that the u64_stats_* api needs renaming.
> s/stats/counter/ because it has no business assuming that the counter
> is being used for statistics.
>
>
Sure. Someone suggested to change the name, considering values could
also be signed (s64 instead of u64_...)
> And all this open-coded per-cpu counter stuff added all over the place.
> Were percpu_counters tested or reviewed and found inadequate and unfixable?
> If so, please do tell.
>
percpu_counters tries hard to maintain a view of the current value of
the (global) counter. This adds a cost because of a shared cache line
and locking. (__percpu_counter_sum() is not very scalable on big hosts,
it locks the percpu_counter lock for a possibly long iteration)
For network stats we dont want to maintain this central value, we do the
folding only when necessary. And this folding has zero effect on
concurrent writers (counter updates)
For network stack, we also need to update two values, a packet counter
and a bytes counter. percpu_counter is not very good for the 'bytes
counter', since we would have to use a arbitrary big bias value.
Using several percpu_counter would also probably use more cache lines.
Also please note this stuff is only needed for 32bit arches.
Using percpu_counter would slow down network stack on modern arches.
I am very well aware of the percpu_counter stuff, I believe I tried to
optimize it a bit in the past.
Thanks
--
To unsubscribe from this list: send the line "unsubscribe netdev" in
the body of a message to majordomo@...r.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
Powered by blists - more mailing lists