Search Linux Wireless

Re: [RFC PATCH v3] average: change non-init state and add check for added values

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

 



On Mon, 2023-04-24 at 21:04 +0000, Benjamin Beichler wrote:
> The uninitialized state 0 involves the danger of reaching that state in
> normal operation. Since the weight_rcp value needs to be bigger than one
> (otherwise no averaging takes place), the final shifting in add ensures,
> that the internal state never reach ULONG_MAX. Therefore use this value
> to signal, that the ewma has no initial value.
> 
> The add function needs to check, that val is not to big, otherwise the new
> value can overflow the internal state, which results in unexpected outputs.

This seems nice to me, FWIW.

> Move the compile time checks into a separate macro, as they are used
> multiple times and noise up the functions.

Why do we even have those multiple times? Should be enough to have them
once, since we always compile the static inline functions?

johannes




[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