From: Simon Lodal <simonl@parknet.dk>
To: Jarek Poplawski <jarkao2@o2.pl>
Cc: Andi Kleen <ak@suse.de>, Patrick McHardy <kaber@trash.net>,
netdev@vger.kernel.org, lartc@mailman.ds9a.nl,
Ingo Oeser <netdev@axxeo.de>
Subject: Re: [PATCH] HTB O(1) class lookup
Date: Mon, 5 Feb 2007 18:14:13 +0100 [thread overview]
Message-ID: <200702051814.13899.simonl@parknet.dk> (raw)
In-Reply-To: <20070205101637.GB1863@ff.dom.local>
On Monday 05 February 2007 11:16, Jarek Poplawski wrote:
> On 01-02-2007 12:30, Andi Kleen wrote:
> > Simon Lodal <simonl@parknet.dk> writes:
> >> Memory is generally not an issue, but CPU is, and you can not beat the
> >> CPU efficiency of plain array lookup (always faster, and constant time).
>
> Probably for some old (or embedded) lean boxes used for
> small network routers, with memory hungry iptables -
> memory could be an issue.
Sure, but if they are that constrained they probably do not run HTB in the
first place.
We are talking about 4k initially, up to 256k worst case (or 512k if your
router is 64bit, unlikely if "small" is a priority).
> > And the worst memory consumption case considered by Patrick should
> > be relatively unlikely.
>
> Anyway, such approach, that most users do something
> this (reasonable) way, doesn't look like good
> programming practice.
The current hash algorithm also assumes certain usage patterns, namely that
you choose classids that generate different hash keys (= distribute uniformly
across the buckets), or scalability will suffer very quickly. Even at 64
classes you would probably see htb_find() near the top of a profiling
analysis.
But I would say that it is just as unlikely as choosing 64 classids that cause
my patch to allocate all 256k.
In these unlikely cases, my patch only wastes passive memory, while the
current htb wastes cpu to a point where it can severely limit routing
performance.
> I wonder, why not try, at least for a while, to do this
> a compile (menuconfig) option with a comment:
> recommended for a large number of classes. After hash
> optimization and some testing, final decisions could be
> made.
I decided not to do it because it would mean too many ifdefs
(ugly+unmaintanable code).
Regards
Simon
next prev parent reply other threads:[~2007-02-05 17:14 UTC|newest]
Thread overview: 12+ messages / expand[flat|nested] mbox.gz Atom feed top
2007-02-01 5:18 [PATCH] HTB O(1) class lookup Simon Lodal
2007-02-01 6:08 ` Patrick McHardy
2007-02-01 7:08 ` Simon Lodal
2007-02-01 11:30 ` Andi Kleen
2007-02-05 10:16 ` Jarek Poplawski
2007-02-05 11:24 ` Andi Kleen
2007-02-05 12:45 ` Ingo Oeser
2007-02-05 17:14 ` Simon Lodal [this message]
2007-02-06 8:08 ` Jarek Poplawski
2007-02-08 7:36 ` Jarek Poplawski
2007-02-05 18:21 ` Simon Lodal
2007-02-01 13:06 ` jamal
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=200702051814.13899.simonl@parknet.dk \
--to=simonl@parknet.dk \
--cc=ak@suse.de \
--cc=jarkao2@o2.pl \
--cc=kaber@trash.net \
--cc=lartc@mailman.ds9a.nl \
--cc=netdev@axxeo.de \
--cc=netdev@vger.kernel.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).