]> git.baikalelectronics.ru Git - kernel.git/commit
pie: remove pie_vars->accu_prob_overflows
authorLeslie Monis <lesliemonis@gmail.com>
Wed, 4 Mar 2020 18:56:01 +0000 (00:26 +0530)
committerDavid S. Miller <davem@davemloft.net>
Wed, 4 Mar 2020 21:25:55 +0000 (13:25 -0800)
commitcec1faeda7ff6fe218ba1811b5becabf59f9698a
treee6045369559f0fb426929d5fee0e22303a7d95e7
parent4406e6e628ce25d6c92f33d86d6929121e2f86f8
pie: remove pie_vars->accu_prob_overflows

The variable pie_vars->accu_prob is used as an accumulator for
probability values. Since probabilty values are scaled using the
MAX_PROB macro denoting (2^64 - 1), pie_vars->accu_prob is
likely to overflow as it is of type u64.

The variable pie_vars->accu_prob_overflows counts the number of
times the variable pie_vars->accu_prob overflows.

The MAX_PROB macro needs to be equal to at least (2^39 - 1) in
order to do precise calculations without any underflow. Thus
MAX_PROB can be reduced to (2^56 - 1) without affecting the
precision in calculations drastically. Doing so will eliminate
the need for the variable pie_vars->accu_prob_overflows as the
variable pie_vars->accu_prob will never overflow.

Removing the variable pie_vars->accu_prob_overflows also reduces
the size of the structure pie_vars to exactly 64 bytes.

Signed-off-by: Mohit P. Tahiliani <tahiliani@nitk.edu.in>
Signed-off-by: Gautam Ramakrishnan <gautamramk@gmail.com>
Signed-off-by: Leslie Monis <lesliemonis@gmail.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
include/net/pie.h
net/sched/sch_fq_pie.c
net/sched/sch_pie.c