Received: by 2002:a25:824b:0:0:0:0:0 with SMTP id d11csp8103543ybn; Tue, 1 Oct 2019 03:18:15 -0700 (PDT) X-Google-Smtp-Source: APXvYqyu7Z9+0uCgmuymT3+QkfFNLj/qtEHrT+OgRoLWO3bwZ5yaDbiGX/ItSPYroUXzjm9Ulr6A X-Received: by 2002:a17:906:27cf:: with SMTP id k15mr23222575ejc.150.1569925095803; Tue, 01 Oct 2019 03:18:15 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1569925095; cv=none; d=google.com; s=arc-20160816; b=cr9PFGQCBKcGQ0eDnXqFNOtvzSHBaXPALIBfCvD0f6nW/M+3xN0wnL0BfU0B1JCkWs Shu7fV+zZyUInwoqXdQ2JYIpcjFDyG6IHQZStBHYWHB4vQSeif+EVmuzluTKzn427m4Z QtVFrkHahS1WXk7hweuPu4+QUCCrNETiGBfIiNFxIcvtHVk3+fY3btyQOrkKN4SY0rTU eOC0+NHVV6Q/K39HdRWNoL0uPF7pKbP9PkPXv8w2itI0s1JlU34xRB6cN7QgV4kMyDn2 btOCT0eAaAdL+jbgc+pTgnI8Kdw8U2aHJun72ysROeiaENjNcGZRhF5okVHLqMFEXimC cA3w== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:content-transfer-encoding:mime-version :user-agent:references:in-reply-to:date:to:from:subject:message-id; bh=UhuEG6b5szyX2IluB3aB0ryDchCAXGcQMBZhKdSO2UA=; b=wnLTDf7FMUXFkiSfqgXNkQXp7LKPQ1UKpvzV7hjpd4V1lFjlquNGjsT6O5oAmGnHNY 4IrjSx66D0ck2K5345Bl+uw+A7obi3rxqGhL0TDXD0AHAOrplAzAtJ6bafsV83tUDENT L8iYaiV6GRLu+rnAoeivpfC9tBcdQCxhxXEIr+kK3zaZhWw8gmRH3mg/okpB2N24oxUe kyp2J4uRsR2FPlwNhfUNeRSsHrQTsKopi6pL1KpPvj3fYFeepPvQj6oiMcKoAqbpNbYf xap0xpAeQkVvpptqk4pkOdP2REPDPrtzCNruthsVsieSNHZjtlIbkgrEtsZvGaXTHDZA HFoA== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: best guess record for domain of linux-wireless-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-wireless-owner@vger.kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id i24si5594035ejh.35.2019.10.01.03.17.49; Tue, 01 Oct 2019 03:18:15 -0700 (PDT) Received-SPF: pass (google.com: best guess record for domain of linux-wireless-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; spf=pass (google.com: best guess record for domain of linux-wireless-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-wireless-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1729841AbfJAKRj (ORCPT + 99 others); Tue, 1 Oct 2019 06:17:39 -0400 Received: from s3.sipsolutions.net ([144.76.43.62]:58778 "EHLO sipsolutions.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726109AbfJAKRj (ORCPT ); Tue, 1 Oct 2019 06:17:39 -0400 Received: by sipsolutions.net with esmtpsa (TLS1.3:ECDHE_SECP256R1__RSA_PSS_RSAE_SHA256__AES_256_GCM:256) (Exim 4.92.2) (envelope-from ) id 1iFFDt-000558-MI; Tue, 01 Oct 2019 12:17:37 +0200 Message-ID: Subject: Re: [PATCH 2/2] mac80211: minstrel_ht: replace rate stats ewma with a better moving average From: Johannes Berg To: Felix Fietkau , linux-wireless@vger.kernel.org Date: Tue, 01 Oct 2019 12:17:36 +0200 In-Reply-To: <20190929154646.90901-2-nbd@nbd.name> References: <20190929154646.90901-1-nbd@nbd.name> <20190929154646.90901-2-nbd@nbd.name> Content-Type: text/plain; charset="UTF-8" User-Agent: Evolution 3.30.5 (3.30.5-1.fc29) MIME-Version: 1.0 Content-Transfer-Encoding: 7bit Sender: linux-wireless-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-wireless@vger.kernel.org > This change replaces the EWMA implementation with a moving average that's > designed to significantly reduce lag while keeping a bigger window size > by being better at filtering out noise. > > It is only slightly more expensive than the simple EWMA and still avoids > divisions in its calculation. > > The algorithm is adapted from an implementation intended for a completely > different field (stock market trading), where the tradeoff of lag vs > noise filtering is equally important. It is based on the "smoothing filter" > from http://www.stockspotter.com/files/PredictiveIndicators.pdf. > > I have adapted it to fixed-point math with some constants so that it uses > only addition, bit shifts and multiplication > Would it be worth pulling that out into similar helpers to EWMA in average.h, perhaps even in the same file? You need to keep a bit more state, but essentially the same API should work since EWMA already declares the "struct ewma_something" once you use the DECLARE_EWMA(). johannes