public inbox for linux-wireless@vger.kernel.org
 help / color / mirror / Atom feed
From: Johannes Berg <johannes@sipsolutions.net>
To: Benjamin Beichler <Benjamin.Beichler@uni-rostock.de>,
	nbd@nbd.name, linux-wireless@vger.kernel.org
Subject: Re: [RFC v2] average: rewrite for clearity
Date: Mon, 24 Apr 2023 17:55:13 +0200	[thread overview]
Message-ID: <bf641b6343baf9a810df41a5d68e0c073a059548.camel@sipsolutions.net> (raw)
In-Reply-To: <bea043c3-1cee-e2a6-ca4b-83e80404358c@uni-rostock.de>

On Fri, 2023-04-21 at 17:16 +0200, Benjamin Beichler wrote:
> > 
> > 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.

Yeah I guess that's the thing, we can accept slower convergence in many
cases, and "safe" start values mean that mostly. But why accept it when
we don't have to?

> 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. 

Not sure I see that as a good argument. The practical engineering side
tends to always be more complex than the theory, and that's not really
unexpected. We can comment why it's different :-)

> The original problem was, that the ewma had a surprising 
> output in a special situation.

Right, but that's an implementation issue, because we thought 0 ==
uninit was clever, without realizing the corner case.

> 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

Not much really, I think? It eases thinking about it though :)

> 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?

Yes. I think 1 bit is enough, but yes, it can't be 0 bits.

johannes

  reply	other threads:[~2023-04-24 15:55 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2023-04-21 13:46 [RFC v2] average: rewrite for clearity Benjamin Beichler
2023-04-21 14:37 ` Johannes Berg
2023-04-21 15:16   ` Benjamin Beichler
2023-04-24 15:55     ` Johannes Berg [this message]
2023-04-24 21:32       ` Benjamin Beichler

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=bf641b6343baf9a810df41a5d68e0c073a059548.camel@sipsolutions.net \
    --to=johannes@sipsolutions.net \
    --cc=Benjamin.Beichler@uni-rostock.de \
    --cc=linux-wireless@vger.kernel.org \
    --cc=nbd@nbd.name \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox