[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <44c1c447befd45e49a06b1e3d3f5f7a6@AcuMS.aculab.com>
Date: Wed, 27 Feb 2019 10:11:14 +0000
From: David Laight <David.Laight@...LAB.COM>
To: 'Leslie Monis' <lesliemonis@...il.com>,
"davem@...emloft.net" <davem@...emloft.net>
CC: "netdev@...r.kernel.org" <netdev@...r.kernel.org>
Subject: RE: [PATCH net-next] net: sched: pie: fix 64-bit division
From: Leslie Monis
> Sent: 27 February 2019 01:00
> Use div_u64() to resolve build failures on 32-bit platforms.
>
> Fixes: 3f7ae5f3dc52 ("net: sched: pie: add more cases to auto-tune alpha and beta")
> Signed-off-by: Leslie Monis <lesliemonis@...il.com>
> ---
> net/sched/sch_pie.c | 2 +-
> 1 file changed, 1 insertion(+), 1 deletion(-)
>
> diff --git a/net/sched/sch_pie.c b/net/sched/sch_pie.c
> index 4c0670b6aec1..f93cfe034c72 100644
> --- a/net/sched/sch_pie.c
> +++ b/net/sched/sch_pie.c
> @@ -429,7 +429,7 @@ static void calculate_probability(struct Qdisc *sch)
> */
>
> if (qdelay == 0 && qdelay_old == 0 && update_prob)
> - q->vars.prob = (q->vars.prob * 98) / 100;
> + q->vars.prob = 98 * div_u64(q->vars.prob, 100);
This has significantly different rounding after the change.
The result for small values is very different.
The alterative:
q->vars.prob -= div_u64(q->vars.prob, 50);
is much nearer to the original - but never goes to zero.
If the 98% decay factor isn't critical then you could remove
1/64th or 1/32nd + 1/16th to avoid the slow division.
David
-
Registered Address Lakeside, Bramley Road, Mount Farm, Milton Keynes, MK1 1PT, UK
Registration No: 1397386 (Wales)
Powered by blists - more mailing lists