Message ID | 20210114181929.1717985-1-eric.dumazet@gmail.com |
---|---|
State | New |
Headers | show |
Series | [net] net_sched: gen_estimator: support large ewma log | expand |
Hello: This patch was applied to netdev/net.git (refs/heads/master): On Thu, 14 Jan 2021 10:19:29 -0800 you wrote: > From: Eric Dumazet <edumazet@google.com> > > syzbot report reminded us that very big ewma_log were supported in the past, > even if they made litle sense. > > tc qdisc replace dev xxx root est 1sec 131072sec ... > > [...] Here is the summary with links: - [net] net_sched: gen_estimator: support large ewma log https://git.kernel.org/netdev/net/c/dd5e073381f2 You are awesome, thank you! -- Deet-doot-dot, I am a bot. https://korg.docs.kernel.org/patchwork/pwbot.html
diff --git a/net/core/gen_estimator.c b/net/core/gen_estimator.c index 80dbf2f4016e26824bc968115503ca2072933f63..8e582e29a41e39809cc534865bb3c91c05b3d9f2 100644 --- a/net/core/gen_estimator.c +++ b/net/core/gen_estimator.c @@ -80,11 +80,11 @@ static void est_timer(struct timer_list *t) u64 rate, brate; est_fetch_counters(est, &b); - brate = (b.bytes - est->last_bytes) << (10 - est->ewma_log - est->intvl_log); - brate -= (est->avbps >> est->ewma_log); + brate = (b.bytes - est->last_bytes) << (10 - est->intvl_log); + brate = (brate >> est->ewma_log) - (est->avbps >> est->ewma_log); - rate = (b.packets - est->last_packets) << (10 - est->ewma_log - est->intvl_log); - rate -= (est->avpps >> est->ewma_log); + rate = (b.packets - est->last_packets) << (10 - est->intvl_log); + rate = (rate >> est->ewma_log) - (est->avpps >> est->ewma_log); write_seqcount_begin(&est->seq); est->avbps += brate; @@ -143,6 +143,9 @@ int gen_new_estimator(struct gnet_stats_basic_packed *bstats, if (parm->interval < -2 || parm->interval > 3) return -EINVAL; + if (parm->ewma_log == 0 || parm->ewma_log >= 31) + return -EINVAL; + est = kzalloc(sizeof(*est), GFP_KERNEL); if (!est) return -ENOBUFS;