Received: by 2002:a05:6358:9144:b0:117:f937:c515 with SMTP id r4csp5794616rwr; Mon, 24 Apr 2023 09:04:06 -0700 (PDT) X-Google-Smtp-Source: AKy350Ygk2Eq1VrwPm5yaG28vr/wRoVPbG3z0cZszSrxeXLz4T61Y+dTJEIrsGZLGHqQjeBMWwQL X-Received: by 2002:a5e:aa1a:0:b0:760:b20b:1cdc with SMTP id s26-20020a5eaa1a000000b00760b20b1cdcmr6145134ioe.17.1682352246349; Mon, 24 Apr 2023 09:04:06 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1682352246; cv=none; d=google.com; s=arc-20160816; b=egw9z8ltCUEdhv/EIMqQI/rhSSL5UPywjvByo5eoxbpAPxDWGZBWFtbQoyUED/XTa7 oohtIBtNWUX5z5Qpd6AdVMZob8s3UGKIGJn3l5+TjjHgdBs7CdTpBPcfIIZfopnaatdH wCR+uk6CRU3n05P4Pyv+b/dtxf7MhtbbJhz5G3OpPZWOFMB6tIg3XUAcDzXQhGAUzAV5 mOgK3II3E4aEZ11kTcdMnD/AgVwPWgP7hEZGP0FFrABvmmoFHfqMl3+V71ViwTwIJrOR 5N7xlBK3Zxq1RpsyRIKd/Nay+eShbvwcw9n7gDUlDbg75mlpr3YhqdcPPXG/wWrdNGR8 NU0Q== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:mime-version:user-agent :content-transfer-encoding:references:in-reply-to:date:to:from :subject:message-id:dkim-signature; bh=g/1mjGCfIMb4t/rbKxT9ddITJFCqtTNLvrrm2VBAcpU=; b=vGaL9On8yWy6jM6RJbLLL6zufd63wgKxQf62PmlCiWtiYBkNXwZVSippaUWC5/CUG1 xpeTYM7572lH/P//6Uvlp5NyZOdnZXAUg2q5yyFek4zX2RgR3znwNbNYWIusu0Z9TV/e lCB+LdOQqykfgGLQZYyDjOhG/yKMeHC1VW2rUQ2BrtCO02ApvWpGrsxhiQreDwZVIu26 +dGaOh4aZoOm/k9DhcwHkcBq2xGwpqhvrp4nbE1Qjkbz/sAkktAXkdk7zmhg2PCg+k3q PnI8mef25ywShFPqpEYnII2jJprHasqnpjDtf2PqcmVYQwtAjqFYVGvTjKafV7cJOJ8E BxUw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@sipsolutions.net header.s=mail header.b=nPvoV1mY; spf=pass (google.com: domain of linux-wireless-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-wireless-owner@vger.kernel.org; dmarc=pass (p=NONE sp=REJECT dis=NONE) header.from=sipsolutions.net Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id cd21-20020a056602429500b00763de3abcc9si458893iob.87.2023.04.24.09.03.40; Mon, 24 Apr 2023 09:04:06 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-wireless-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; dkim=pass header.i=@sipsolutions.net header.s=mail header.b=nPvoV1mY; spf=pass (google.com: domain of linux-wireless-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-wireless-owner@vger.kernel.org; dmarc=pass (p=NONE sp=REJECT dis=NONE) header.from=sipsolutions.net Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S232145AbjDXPzm (ORCPT + 62 others); Mon, 24 Apr 2023 11:55:42 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:56588 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S231851AbjDXPze (ORCPT ); Mon, 24 Apr 2023 11:55:34 -0400 Received: from sipsolutions.net (s3.sipsolutions.net [IPv6:2a01:4f8:191:4433::2]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 6BCE7A246 for ; Mon, 24 Apr 2023 08:55:18 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=sipsolutions.net; s=mail; h=MIME-Version:Content-Transfer-Encoding: Content-Type:References:In-Reply-To:Date:To:From:Subject:Message-ID:Sender: Reply-To:Cc:Content-ID:Content-Description:Resent-Date:Resent-From:Resent-To: Resent-Cc:Resent-Message-ID; bh=g/1mjGCfIMb4t/rbKxT9ddITJFCqtTNLvrrm2VBAcpU=; t=1682351718; x=1683561318; b=nPvoV1mY9ApoHa95gGUqRbtLa20zWaXI6nB4755ZAoijMx+ MCvwHa3/BvGyKjs9lcwaq2MOXzi+z4EhNw9fGbHAOE2Hb4s5npK3ivgNwALmNGZnXdKNzakY0xp0D gRrLL7ztYLIq+LrAytoa8HQFwT6RnYX9lZF2hmjB4ExsxS/0/qYi5eUtH7W2ZFUQX0dFEHWjCuIQy k0KrUb9n+sSAJe4H6b9Blx9geBX2CW/VASmgwsNVJcnY1ksAgechK1PuTgk1I61ENUsVOVCpXJwpb NJUX6YH0ezEvD2qrgS2rXRgvKpAA0fi7opb6YytFq7gyjNzoHzSvszJ5s7UtfV1w==; Received: by sipsolutions.net with esmtpsa (TLS1.3:ECDHE_X25519__RSA_PSS_RSAE_SHA256__AES_256_GCM:256) (Exim 4.96) (envelope-from ) id 1pqyX4-007Iho-1u; Mon, 24 Apr 2023 17:55:14 +0200 Message-ID: Subject: Re: [RFC v2] average: rewrite for clearity From: Johannes Berg To: Benjamin Beichler , nbd@nbd.name, linux-wireless@vger.kernel.org Date: Mon, 24 Apr 2023 17:55:13 +0200 In-Reply-To: References: <20230421134604.211128-1-benjamin.beichler@uni-rostock.de> <3f505aba559d4ce068ef6d2fd7743045e0d93b9f.camel@sipsolutions.net> Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable User-Agent: Evolution 3.46.4 (3.46.4-1.fc37) MIME-Version: 1.0 X-malware-bazaar: not-scanned X-Spam-Status: No, score=-2.1 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,SPF_HELO_PASS,SPF_PASS, T_SCC_BODY_TEXT_LINE autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-wireless@vger.kernel.org On Fri, 2023-04-21 at 17:16 +0200, Benjamin Beichler wrote: > >=20 > > 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 biasin= g > > 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 ... >=20 > I left out the the individual fixes for users, but for the samples I=20 > looked into, either start values were given, or they were semantically= =20 > extractable. >=20 > e.g. virtios pkt_len=C2=A0 ewma is clamped anyways, so using the clamp bo= rder=20 > or in between will be safe. >=20 > Most others are signals-strengths, many of them also only for=20 > 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=20 > add_or_init function, it simply resembles the ewma filter of a math or= =20 > CS-textbook.=C2=A0 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=20 > output in a special situation. Right, but that's an implementation issue, because we thought 0 =3D=3D uninit was clever, without realizing the corner case. > But while writing the commit, I recognized, that the current ewma=20 > implementation is only for unsigned values, which means the problem=20 > really only happens for many consecutive 0 values. I try to think over,= =20 > what this means for the proposal of Felix, but I'm not able to think=20 > 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=20 > check, that the precision has at least 2 or 4 bits, to really avoid the= =20 > problem, shouldn't we? Yes. I think 1 bit is enough, but yes, it can't be 0 bits. johannes