[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[altq 1433] altq-3.1 on top of FreeBSD 4.5: HFSC bug/problem
Hi!
I've found a minor bug in the HFSC code that sometimes causes HFSC to
behave rather unfair under link-sharing scheduler distributing all the
excess bandwidth to a single class. This applies to FreeBSD 4.5 but may
also apply to other *BSDs/versions.
The problem function is init_v(). It uses function max() on 64-bit vt
values, while in the <SYS-SRC-PATH>/sys/libkern.h max() is defined to
operate on 32-bit u_int-s. Because of this the vt value is sometimes
truncated to 32 bits, i.e. becomes significantly lower that those of
competing sibling classes and the class in question receives unfair amount
of link-sharing service.
The below patch fixes the problem by simply avoiding the finction max().
I hope this doesn't significantly influence the clarity of the code.
==========================================================================
--- altq_hfsc.c.orig Wed Feb 20 06:30:11 2002
+++ altq_hfsc.c Sat Apr 20 08:45:11 2002
@@ -873,9 +873,8 @@
*/
max_cl = actlist_last(cl->cl_parent->cl_actc);
vt = (min_cl->cl_vt + max_cl->cl_vt) / 2;
- if (cl->cl_parent->cl_vtperiod == cl->cl_parentperiod)
- vt = max(cl->cl_vt, vt);
- cl->cl_vt = vt;
+ if (cl->cl_parent->cl_vtperiod != cl->cl_parentperiod || vt > cl->cl_vt)
+ cl->cl_vt = vt;
} else {
/* no packet is backlogged. set vt to 0 */
cl->cl_vt = 0;
==========================================================================
--
Olwi