Martin Devera aka devik (email@example.com)
Last updated: 7.12.2003
Back to QoS page
HTB is packet scheduler. It is currently included in
stock Linux kernels from 2.4.20. To read news see
For Czech: Hledam programatora
Rad bych do naseho tymu sehnal
spolehliveho PHP programatora. Neni treba virtuos staci solidni
interpret ;-). JS, Perl, C vitano, stejne tak smysl pro korektni
modularni a komentovany kod. Moznosti lecos se priucit v ramci
pracovni doby. Flex. prac. doba ale pouze v sidle firmy (Pha, Jarov).
To same plati pro admina. Napln prace - sprava par desitek serveru,
Exim, Apache, PHP, MySQL, PgSQL, SpamAssassin a dalsi proprietarni sw.
Please general question regarding HTB should be send to LARTC
mailing list. See http://lartc.org.
I accept only bug reports and assume you read FAQ below.
Please assume that HTB related mails to me are not considered
to be private unless you explicitly ask for it. In other words
it means that I can put them into FAQ for example.
User guide (PDF version)
Theory and implementation
HTB3 performance analysis
Czech documents from my presentation at SLT 2002 in town Sec.
These are part of ISBN 80-7302-043-2 by Konvoj and you can
download them only for your private use.
STL 2002 HTB description
SLT 2002 Presentation slides
Older theory and ideas
Older performance measurements
Ideas on HTB1->HTB3 way
- LARTC- well known site devoted to
routing and QoS in 2.4 kernels.
- docum.org - site with interesting
- Moderated low volume listserv for announcements. You can subscribe
by sending mail with subject "subscribe" to firstname.lastname@example.org.
You will get infor about HTB events. You can't post there !
- LARTC list - there are many people using HTB. It is general purporse
list. See http://lartc.org.
To get tc tool for 2.4.20 and newer kernels, download htb3.6-020525.tgz
below. It contains both binary and patch against iproute2. I hope Alexey will
release new iproute2 soon (he claims it contains HTB code already).
HTB3 code (public beta, this is if you want to patch older 2.4 kernels but
I strongly recomment you to use 2.4.20 or more recent one):
htb3.6-020525.tgz is the latest archive
with patches, Changelog and tc binary.
Tested with 2.4.17 and probably other 2.4.x will be ok.
The file contains also rb_tree export patch which is now in 2.4.19pre. You
may get some patch errors on kernels 2.4.19pre and newer.
Note that you have to use new tc tool.
diff against 2.2.17 and probably other 2.2.x
diff against 2.4.17 and probably other 2.4.x
diff against iproute2 rel 991023
and tc binary (Warning: this doesn't work with HTB3 !!)
- Witold Szczerba spent his time evaluating fairness of borrowing. His
troubles inspired me enough to analyze the problem: When a class changes
from yellow to green it disconnects itself from parent's feedlist.
Unfortunately it resets feed pointer to the first child. I created a patch
where the class uses classid to remember its position in the feedlist.
The patch for 2.4.24 and hopefully others is
here. It will
be included in next kernel releases. PLEASE report me any problems
with it !
- Two oopses were found by zhaoyao and Daniel Blueman. Patch against
2.4.23 and 2.6.0-test10 is
here. It will
be included in next kernel releases of course.
- Walter Karshat created patch which implements per packet overhead and
MPU. You can get it here. Overhead
implementation is a bit hack but when you need it you will be satisfied :-)
No tc binary yet.
- Wilfried Weissmann spotted bug in dequeue code and helped with fix.
This patch contains one below thus needs to be applied after patch
from 20.6.2003. It is here. This
one will appear in 2.4.23 because it is too late for 2.4.22.
- I changed Tobias' patch to disable debug dump during tc qdisc show command.
It is cumulative patch against the one below.
- Patch against 2.4.21 release. It fixes dequeue(n) bug hopefully. It will be
included in next kernel but in meanwhile download it
- I lost track of dates so meanwhile 2.4.20 HTB is out and FAQ section was added.
- HTB included in 2.4.20pre1 and next 2.5.x patch.
- Alexey told me that he included HTB into latest iproute2 package.
- Another guy informed me about plans to include backport into 2.2.
- HTB sites totaly redesigned. I hope it is now more readable ...
- Minor changes into HTB3 .. seems to work well.
- Greg Louis had problems with HTB3 and 2.4.19pre7. The reason is that
ANK changed PSCHED_TDIFF_SAFE function in pre5. Send message to netdev.
- New HTB3 finished. Need testers. Look at this for performance
analysis. At bottom of this page are new patches. Major changes:
As you can see the new HTB is almost the same from user's view. It is
ok. The only goal was speed and clean design.
- Scalable and fast code. Major code cleanup.
- You can set quantum for each class which allows you to control how
bw is distributed under single parent.
- Injecting is gone. Sorry. It was experimental feature and it'd complicate
- No 2.2 version ! Maybe someone will backport it - it is not hard
but I use rb_tree which is part of 2.4. One could copy the files
and it should work. But now I concentrate on 2.4.
- My special circular lists are gone - now I use standard struct list_head.
- Allow to attach a filter to a leaf. It is needed by tc_index filter used in diffserv.
- Updated source to support 2.4.17 (which removed CONFIG_RTNETLINK).
- Here is preliminary of HTB2 theory paper.
- Bug in new beta regarding "default" keyword fixed. Thanks goes to Claudio Neves.
- Binary tc added.
- Beta of new version. See patches htb2_xxx. HTB timer > 5 sec bug fix.
- Added ability to bind classifiers (filters) to inner nodes.
- Added internal fifo queue which allows you to pass unclassified
packets directly thru at full speed. It can be also selected explicitly
as class :0.
- Code prepared for merge into 2.4 mainline.
- In TC you don't have to specify "burst" and "cburst" anymore. The tc tool
will compute it for you (you can still override it).
- Urgent: see comments at download section of this page
- Oops in class delete fixed (thanks to Martin Josefsson)
- Parts of this manual rewriten and my bad English fixed (thanks to Don Cohen)
- Nasty bug with class stalls fixed (thanks to Vladimir Smelhaus).
- New tc qdisc parameter to turn debug tracing of variour subsystems on and off.
HTB now comes with debugging compiled in but turned off to simplify problem
localization by regular users.
- Added #include<linux/version.h> which was not needed in 2.4.12.
- I turned debugging messages off finally.
- Added binary tc tool (many wanted it)
- ondrej kraus reminded me that htb doesn't work as non-module. fixed.
- he also noted that packets going to nonexistent class should not be
dropped as it can fool administrator (cut his ssh connection :-). now
such packets go slowly (!) thru.
- Slots removed. The whole idea was a hack and now
it is replaced by much cleaner approach called Intermediate Queue (IMQ).
See my QOS page for it. A
nice side effect of removal is much cleaner and shorter code. And it is
2.4 SMP safe finally.
- Added idea of injecting but not extensively tested yet.
- Changed DRR to multilevel-DRR (more fair).
- Revision 1.6 of sch_htb.c marked as v1.0 of HTB.