* [PATCH] small optimization in __ip_conntrack_find()
@ 2002-06-07 23:00 Martin Josefsson
2002-06-11 7:51 ` Harald Welte
0 siblings, 1 reply; 2+ messages in thread
From: Martin Josefsson @ 2002-06-07 23:00 UTC (permalink / raw)
To: Netfilter-devel
[-- Attachment #1: Type: text/plain, Size: 352 bytes --]
Hi,
Attached is a small optimization for __ip_conntrack_find().
The way I read the use of the LIST_FIND macro it seems that we are
calling hash_conntrack() for each iteration with the same inparameters.
My change calls it once before looping.
--
/Martin
Never argue with an idiot. They drag you down to their level, then beat
you with experience.
[-- Attachment #2: ip_conntrack_core.c-find-diff --]
[-- Type: text/plain, Size: 601 bytes --]
--- linux-2.4.19-pre10/net/ipv4/netfilter/ip_conntrack_core.c.orig Sat Jun 8 00:48:59 2002
+++ linux-2.4.19-pre10/net/ipv4/netfilter/ip_conntrack_core.c Sat Jun 8 00:49:56 2002
@@ -292,9 +292,10 @@
const struct ip_conntrack *ignored_conntrack)
{
struct ip_conntrack_tuple_hash *h;
+ size_t hash = hash_conntrack(tuple);
MUST_BE_READ_LOCKED(&ip_conntrack_lock);
- h = LIST_FIND(&ip_conntrack_hash[hash_conntrack(tuple)],
+ h = LIST_FIND(&ip_conntrack_hash[hash],
conntrack_tuple_cmp,
struct ip_conntrack_tuple_hash *,
tuple, ignored_conntrack);
^ permalink raw reply [flat|nested] 2+ messages in thread
* Re: [PATCH] small optimization in __ip_conntrack_find()
2002-06-07 23:00 [PATCH] small optimization in __ip_conntrack_find() Martin Josefsson
@ 2002-06-11 7:51 ` Harald Welte
0 siblings, 0 replies; 2+ messages in thread
From: Harald Welte @ 2002-06-11 7:51 UTC (permalink / raw)
To: Martin Josefsson; +Cc: Netfilter-devel
[-- Attachment #1: Type: text/plain, Size: 933 bytes --]
On Sat, Jun 08, 2002 at 01:00:59AM +0200, Martin Josefsson wrote:
> Hi,
>
> Attached is a small optimization for __ip_conntrack_find().
> The way I read the use of the LIST_FIND macro it seems that we are
> calling hash_conntrack() for each iteration with the same inparameters.
Thanks. My assumption was that this is actually done by the optimization
code of gcc. But from looking at the disassembled compiler output, there
is actually quite a difference between the old and the new code.
> My change calls it once before looping.
i'll put this into pending.
> /Martin
--
Live long and prosper
- Harald Welte / laforge@gnumonks.org http://www.gnumonks.org/
============================================================================
GCS/E/IT d- s-: a-- C+++ UL++++$ P+++ L++++$ E--- W- N++ o? K- w--- O- M+
V-- PS++ PE-- Y++ PGP++ t+ 5-- !X !R tv-- b+++ !DI !D G+ e* h--- r++ y+(*)
[-- Attachment #2: Type: application/pgp-signature, Size: 232 bytes --]
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2002-06-11 7:51 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2002-06-07 23:00 [PATCH] small optimization in __ip_conntrack_find() Martin Josefsson
2002-06-11 7:51 ` Harald Welte
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.