public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
From: Jesper Juhl <jesper.juhl@gmail.com>
To: Linux Kernel Mailing List <linux-kernel@vger.kernel.org>
Cc: Netfilter Core Team <coreteam@netfilter.org>,
	Rusty Russell <rusty@rustcorp.com.au>,
	Andrew Morton <akpm@osdl.org>,
	Jesper Juhl <jesper.juhl@gmail.com>
Subject: [PATCH] Decrease number of pointer derefs in nf_conntrack_core.c
Date: Thu, 8 Dec 2005 23:36:19 +0100	[thread overview]
Message-ID: <200512082336.19695.jesper.juhl@gmail.com> (raw)

Hi,

Here's a small patch to decrease the number of pointer derefs in
net/netfilter/nf_conntrack_core.c

Benefits of the patch:
 - Fewer pointer dereferences should make the code slightly faster.
 - Size of generated code is smaller
 - improved readability

Please consider applying.


Signed-off-by: Jesper Juhl <jesper.juhl@gmail.com>
---


 net/netfilter/nf_conntrack_core.c |    7 ++++---
 1 files changed, 4 insertions(+), 3 deletions(-)

orig:
   text    data     bss     dec     hex filename
  12636      49     760   13445    3485 net/netfilter/nf_conntrack_core.o

patched:
   text    data     bss     dec     hex filename
  11825     183     632   12640    3160 net/netfilter/nf_conntrack_core.o

--- linux-2.6.15-rc5-git1-orig/net/netfilter/nf_conntrack_core.c	2005-12-04 18:48:58.000000000 +0100
+++ linux-2.6.15-rc5-git1/net/netfilter/nf_conntrack_core.c	2005-12-08 20:13:03.000000000 +0100
@@ -1129,6 +1129,7 @@ static inline int refresh_timer(struct n
 int nf_conntrack_expect_related(struct nf_conntrack_expect *expect)
 {
 	struct nf_conntrack_expect *i;
+	struct nf_conn *master = expect->master;
 	int ret;
 
 	DEBUGP("nf_conntrack_expect_related %p\n", related_to);
@@ -1149,9 +1150,9 @@ int nf_conntrack_expect_related(struct n
 		}
 	}
 	/* Will be over limit? */
-	if (expect->master->helper->max_expected && 
-	    expect->master->expecting >= expect->master->helper->max_expected)
-		evict_oldest_expect(expect->master);
+	if (master->helper->max_expected && 
+	    master->expecting >= master->helper->max_expected)
+		evict_oldest_expect(master);
 
 	nf_conntrack_expect_insert(expect);
 	nf_conntrack_expect_event(IPEXP_NEW, expect);



             reply	other threads:[~2005-12-08 22:35 UTC|newest]

Thread overview: 8+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2005-12-08 22:36 Jesper Juhl [this message]
2005-12-09  5:05 ` [netfilter-core] [PATCH] Decrease number of pointer derefs in nf_conntrack_core.c Harald Welte
2005-12-09 11:04 ` Ingo Molnar
2005-12-09 10:18   ` Jesper Juhl
2005-12-09 10:36     ` Tim Schmielau
2005-12-09 11:49       ` Ingo Molnar
2005-12-11  1:47         ` Jesper Juhl
2005-12-12  7:30 ` [netfilter-core] " Patrick McHardy

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=200512082336.19695.jesper.juhl@gmail.com \
    --to=jesper.juhl@gmail.com \
    --cc=akpm@osdl.org \
    --cc=coreteam@netfilter.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=rusty@rustcorp.com.au \
    /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