Search Linux Wireless

Re: [RFC v2] average: rewrite for clearity

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Am 21.04.2023 um 16:37 schrieb Johannes Berg:
________________________________
  Achtung! Externe E-Mail: Klicken Sie erst dann auf Links und Anhänge, nachdem Sie die Vertrauenswürdigkeit der Absenderadresse geprüft haben.
________________________________

On Fri, 2023-04-21 at 13:46 +0000, Benjamin Beichler wrote:
Move the former *_add function with its implicit initialization into a
separate function, when the user explicitly wants to init with the first
added value, although this creates issues, when 0 is a expected value for
the internal value.

Add a separate init function with value parameter to allow init with
distinct value, which was formerly done by the implicit init of old
*_add function.

Sure, this is what you said :-)

I still don't really think it's feasible. First, this breaks all the
users, because if you have e.g. virtio's DECLARE_EWMA(pkt_len, 0, 64)
then it will take a long time to get away from 0.

So then we could say we'll just fix them, but what value actually makes
sense to init with? You don't necessarily know, right? Initially biasing
towards the first value makes a lot more sense than initially biasing
towards zero, no? And then if you want to achieve that, now you have to
either use _add_or_init(), which is probably what people will do, but
that continues having the problem ...

I left out the the individual fixes for users, but for the samples I looked into, either start values were given, or they were semantically extractable.

e.g. virtios pkt_len  ewma is clamped anyways, so using the clamp border or in between will be safe.

Most others are signals-strengths, many of them also only for statistics, where a slow convergence is okay in my opinion.

I don't really see how this is a net improvement - we'd still have to
fix the individual users with it, e.g. maybe the mesh case that started
this investigation could bias towards success (init with 100) and then
use _add() rather than _add_or_init(), but then again we're back to
having to make individual choices with the users. I don't really see how
that's better than fixing it for real with the existing behaviour of
biasing towards the first value?

IMHO the net improvement is, that if you do not use the convenience add_or_init function, it simply resembles the ewma filter of a math or CS-textbook. The original problem was, that the ewma had a surprising output in a special situation.

But while writing the commit, I recognized, that the current ewma implementation is only for unsigned values, which means the problem really only happens for many consecutive 0 values. I try to think over, what this means for the proposal of Felix, but I'm not able to think about unsigned C-arithmetics today :-D

If we use that fix, then we should have an additional compile time check, that the precision has at least 2 or 4 bits, to really avoid the problem, shouldn't we?

Benjamin




[Index of Archives]     [Linux Host AP]     [ATH6KL]     [Linux Wireless Personal Area Network]     [Linux Bluetooth]     [Wireless Regulations]     [Linux Netdev]     [Kernel Newbies]     [Linux Kernel]     [IDE]     [Git]     [Netfilter]     [Bugtraq]     [Yosemite Hiking]     [MIPS Linux]     [ARM Linux]     [Linux RAID]

  Powered by Linux