Re: include/linux/pcounter.h

!MAILaRCHIVE_VOTE_RePLACE
Previous message: [thread] [date] [author]
Next message: [thread] [date] [author]
To: Eric Dumazet <dada1@...>
Cc: Herbert Xu <herbert@...>, David S. Miller <davem@...>, <netdev@...>, <linux-kernel@...>
Date: Saturday, February 16, 2008 - 6:50 am

On Sat, 16 Feb 2008 11:07:29 +0100 Eric Dumazet <dada1@cosmosbay.com> wrote:


It's buggy!  Main problems are a) possible return of negative numbers b)
some of the API can't be from preemptible code c) excessive interrupt-off
time on some machines if used from irq-disabled sections.


numbers?

most of percpu_counter_add() is only executed once per FBC_BATCH calls.


Well maybe as a temporary networking-only thing OK, based upon
performance-tested results.  But I don't think the present code is suitable
as part of the kernel-wide toolkit.


No, percpu_counters use alloc_percpu(), which is O(num_possible_cpus), not
O(NR_CPUS).


This was put in ./lib/!


Well the present single caller in networking might not care.  But this was
put in ./lib/ and was exported to modules.  That is an invitation to all
kernel developers to use it in new code.  Which may result in truly awful
performance on high-cpu-count machines.


eh?  It's called on a per-connection basis, not on a per-packet basis?


For the current single caller.  But it's in ./lib/.

And there's always someone out there who does whatever we don't expect them
to do.


I can't find that code.  I suspect that's the DEFINE_PER_CPU flavour, which
isn't used anywhere afaict.  Plus this omits the local_irq_save/restore (or
preempt_disable/enable) and the indirect function call, which can be
expensive.


One of the above two branches is taken ((FBC_BATCH-1)/FBC_BATCH)ths of the
time.



Some of the stuff in there is from the __percpu_disguise() thing which we
probably can live without.

But I'd be surprised if benchmarking reveals that the pcounter code is
justifiable in its present networking application or indeed in any future
ones.


No we don't.  That comment is afaict wrong about the memory consumption and
the abstraction *isn't useful*.

Why do we want some abstraction which makes alloc_percpu() storage and
DEFINE_PERCPU storage "look the same"?  What use is there in that?  One is
per-object storage and one is singleton storage - they're quite different
things and they are used in quite different situations and they are
basically never interchangeable.  Yet we add this pretend-they're-the-same
wrapper around them which costs us an indirect function call on the
fastpath.
--
Previous message: [thread] [date] [author]
Next message: [thread] [date] [author]

Messages in current thread:
include/linux/pcounter.h, Andrew Morton, (Mon Feb 4, 5:44 am)
Re: include/linux/pcounter.h, Andrew Morton, (Fri Feb 15, 11:37 pm)
Re: include/linux/pcounter.h, Eric Dumazet, (Sat Feb 16, 6:07 am)
Re: include/linux/pcounter.h, Andrew Morton, (Sat Feb 16, 6:50 am)
Re: include/linux/pcounter.h, Eric Dumazet, (Sat Feb 16, 8:03 am)
Re: include/linux/pcounter.h, Andrew Morton, (Sat Feb 16, 3:26 pm)
Re: include/linux/pcounter.h, David Miller, (Sun Feb 17, 1:54 am)
Re: include/linux/pcounter.h, Ingo Molnar, (Tue Feb 26, 5:24 am)
Re: include/linux/pcounter.h, David Miller, (Tue Feb 26, 5:35 pm)
Re: include/linux/pcounter.h, Ingo Molnar, (Wed Feb 27, 3:36 am)
Re: include/linux/pcounter.h, Arnaldo Carvalho de Melo, (Wed Feb 27, 9:27 pm)
Re: include/linux/pcounter.h, Arjan van de Ven, (Sat Feb 16, 3:39 pm)
Re: include/linux/pcounter.h, David Miller, (Mon Feb 4, 8:20 pm)
Re: include/linux/pcounter.h, Andrew Morton, (Mon Feb 4, 8:43 pm)