All of lore.kernel.org
 help / color / mirror / Atom feed
* [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

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.