* [PATCH] Decrease number of pointer derefs in nf_conntrack_core.c
@ 2005-12-08 22:36 Jesper Juhl
2005-12-09 5:05 ` [netfilter-core] " Harald Welte
` (2 more replies)
0 siblings, 3 replies; 8+ messages in thread
From: Jesper Juhl @ 2005-12-08 22:36 UTC (permalink / raw)
To: Linux Kernel Mailing List
Cc: Netfilter Core Team, Rusty Russell, Andrew Morton, Jesper Juhl
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);
^ permalink raw reply [flat|nested] 8+ messages in thread* Re: [netfilter-core] [PATCH] Decrease number of pointer derefs in nf_conntrack_core.c
2005-12-08 22:36 [PATCH] Decrease number of pointer derefs in nf_conntrack_core.c Jesper Juhl
@ 2005-12-09 5:05 ` Harald Welte
2005-12-09 11:04 ` Ingo Molnar
2005-12-12 7:30 ` [netfilter-core] " Patrick McHardy
2 siblings, 0 replies; 8+ messages in thread
From: Harald Welte @ 2005-12-09 5:05 UTC (permalink / raw)
To: Jesper Juhl
Cc: Linux Kernel Mailing List, Andrew Morton, Rusty Russell,
Netfilter Core Team, Patrick McHardy
[-- Attachment #1: Type: text/plain, Size: 610 bytes --]
On Thu, Dec 08, 2005 at 11:36:19PM +0100, Jesper Juhl wrote:
> Here's a small patch to decrease the number of pointer derefs in
> net/netfilter/nf_conntrack_core.c
thanks, looks fine.
Patrick: please merge into your queue, too.
--
- Harald Welte <laforge@netfilter.org> http://netfilter.org/
============================================================================
"Fragmentation is like classful addressing -- an interesting early
architectural error that shows how much experimentation was going
on while IP was being designed." -- Paul Vixie
[-- Attachment #2: Type: application/pgp-signature, Size: 189 bytes --]
^ permalink raw reply [flat|nested] 8+ messages in thread
* Re: [PATCH] Decrease number of pointer derefs in nf_conntrack_core.c
2005-12-08 22:36 [PATCH] Decrease number of pointer derefs in nf_conntrack_core.c Jesper Juhl
2005-12-09 5:05 ` [netfilter-core] " Harald Welte
@ 2005-12-09 11:04 ` Ingo Molnar
2005-12-09 10:18 ` Jesper Juhl
2005-12-12 7:30 ` [netfilter-core] " Patrick McHardy
2 siblings, 1 reply; 8+ messages in thread
From: Ingo Molnar @ 2005-12-09 11:04 UTC (permalink / raw)
To: Jesper Juhl
Cc: Linux Kernel Mailing List, Netfilter Core Team, Rusty Russell,
Andrew Morton
* Jesper Juhl <jesper.juhl@gmail.com> wrote:
> 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
just a question - are you sure the measurements are accurate in this
case? The patch looks too small to shave more than 800 bytes off .text!
If it's real then something really wrong is going on in gcc-land ...
Ingo
^ permalink raw reply [flat|nested] 8+ messages in thread
* Re: [PATCH] Decrease number of pointer derefs in nf_conntrack_core.c
2005-12-09 11:04 ` Ingo Molnar
@ 2005-12-09 10:18 ` Jesper Juhl
2005-12-09 10:36 ` Tim Schmielau
0 siblings, 1 reply; 8+ messages in thread
From: Jesper Juhl @ 2005-12-09 10:18 UTC (permalink / raw)
To: Ingo Molnar
Cc: Linux Kernel Mailing List, Netfilter Core Team, Rusty Russell,
Andrew Morton
On 12/9/05, Ingo Molnar <mingo@elte.hu> wrote:
>
> * Jesper Juhl <jesper.juhl@gmail.com> wrote:
>
> > 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
>
> just a question - are you sure the measurements are accurate in this
> case? The patch looks too small to shave more than 800 bytes off .text!
> If it's real then something really wrong is going on in gcc-land ...
>
I did all this with an allyesconfig kernel source and then did :
make net/netfilter/nf_conntrack_core.o
size net/netfilter/nf_conntrack_core.o
rm net/netfilter/nf_conntrack_core.o
then applied the patch and redid
make net/netfilter/nf_conntrack_core.o
size net/netfilter/nf_conntrack_core.o
So I believe the numbers should be correct, but I'm not at home atm,
so I can't verify right now. I won't have a chance to look at it until
tomorrow, but then I'll double-check.
--
Jesper Juhl <jesper.juhl@gmail.com>
Don't top-post http://www.catb.org/~esr/jargon/html/T/top-post.html
Plain text mails only, please http://www.expita.com/nomime.html
^ permalink raw reply [flat|nested] 8+ messages in thread
* Re: [PATCH] Decrease number of pointer derefs in nf_conntrack_core.c
2005-12-09 10:18 ` Jesper Juhl
@ 2005-12-09 10:36 ` Tim Schmielau
2005-12-09 11:49 ` Ingo Molnar
0 siblings, 1 reply; 8+ messages in thread
From: Tim Schmielau @ 2005-12-09 10:36 UTC (permalink / raw)
To: Jesper Juhl
Cc: Ingo Molnar, Linux Kernel Mailing List, Netfilter Core Team,
Rusty Russell, Andrew Morton
On Fri, 9 Dec 2005, Jesper Juhl wrote:
> On 12/9/05, Ingo Molnar <mingo@elte.hu> wrote:
> >
> > * Jesper Juhl <jesper.juhl@gmail.com> wrote:
> >
> > > 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
> >
> > just a question - are you sure the measurements are accurate in this
> > case? The patch looks too small to shave more than 800 bytes off .text!
> > If it's real then something really wrong is going on in gcc-land ...
> >
> I did all this with an allyesconfig kernel source and then did :
> make net/netfilter/nf_conntrack_core.o
> size net/netfilter/nf_conntrack_core.o
> rm net/netfilter/nf_conntrack_core.o
> then applied the patch and redid
> make net/netfilter/nf_conntrack_core.o
> size net/netfilter/nf_conntrack_core.o
>
> So I believe the numbers should be correct, but I'm not at home atm,
> so I can't verify right now. I won't have a chance to look at it until
> tomorrow, but then I'll double-check.
I get
orig:
text data bss dec hex filename
11745 67 728 12540 30fc net/netfilter/nf_conntrack_core.o
patched:
text data bss dec hex filename
11681 67 728 12476 30bc net/netfilter/nf_conntrack_core.o
> gcc --version
gcc (GCC) 4.0.2 20050901 (prerelease) (SUSE Linux)
Tim
^ permalink raw reply [flat|nested] 8+ messages in thread
* Re: [PATCH] Decrease number of pointer derefs in nf_conntrack_core.c
2005-12-09 10:36 ` Tim Schmielau
@ 2005-12-09 11:49 ` Ingo Molnar
2005-12-11 1:47 ` Jesper Juhl
0 siblings, 1 reply; 8+ messages in thread
From: Ingo Molnar @ 2005-12-09 11:49 UTC (permalink / raw)
To: Tim Schmielau
Cc: Jesper Juhl, Linux Kernel Mailing List, Netfilter Core Team,
Rusty Russell, Andrew Morton
* Tim Schmielau <tim@physik3.uni-rostock.de> wrote:
> I get
> orig:
> text data bss dec hex filename
> 11745 67 728 12540 30fc net/netfilter/nf_conntrack_core.o
>
> patched:
> text data bss dec hex filename
> 11681 67 728 12476 30bc net/netfilter/nf_conntrack_core.o
yeah, that's OK and in the expected range.
Ingo
^ permalink raw reply [flat|nested] 8+ messages in thread
* Re: [PATCH] Decrease number of pointer derefs in nf_conntrack_core.c
2005-12-09 11:49 ` Ingo Molnar
@ 2005-12-11 1:47 ` Jesper Juhl
0 siblings, 0 replies; 8+ messages in thread
From: Jesper Juhl @ 2005-12-11 1:47 UTC (permalink / raw)
To: Ingo Molnar
Cc: Tim Schmielau, Linux Kernel Mailing List, Netfilter Core Team,
Rusty Russell, Andrew Morton
On 12/9/05, Ingo Molnar <mingo@elte.hu> wrote:
>
> * Tim Schmielau <tim@physik3.uni-rostock.de> wrote:
>
> > I get
> > orig:
> > text data bss dec hex filename
> > 11745 67 728 12540 30fc net/netfilter/nf_conntrack_core.o
> >
> > patched:
> > text data bss dec hex filename
> > 11681 67 728 12476 30bc net/netfilter/nf_conntrack_core.o
>
> yeah, that's OK and in the expected range.
>
Ingo, Tim, you are correct. I did screw up the size measurements for
that one patch. Sorry about that.
--
Jesper Juhl <jesper.juhl@gmail.com>
Don't top-post http://www.catb.org/~esr/jargon/html/T/top-post.html
Plain text mails only, please http://www.expita.com/nomime.html
^ permalink raw reply [flat|nested] 8+ messages in thread
* Re: [netfilter-core] [PATCH] Decrease number of pointer derefs in nf_conntrack_core.c
2005-12-08 22:36 [PATCH] Decrease number of pointer derefs in nf_conntrack_core.c Jesper Juhl
2005-12-09 5:05 ` [netfilter-core] " Harald Welte
2005-12-09 11:04 ` Ingo Molnar
@ 2005-12-12 7:30 ` Patrick McHardy
2 siblings, 0 replies; 8+ messages in thread
From: Patrick McHardy @ 2005-12-12 7:30 UTC (permalink / raw)
To: Jesper Juhl
Cc: Linux Kernel Mailing List, Andrew Morton, Rusty Russell,
Netfilter Core Team
Jesper Juhl wrote:
> 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.
I've added both patches to my 2.6.16 queue, thanks Jesper.
^ permalink raw reply [flat|nested] 8+ messages in thread
end of thread, other threads:[~2005-12-12 7:30 UTC | newest]
Thread overview: 8+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2005-12-08 22:36 [PATCH] Decrease number of pointer derefs in nf_conntrack_core.c Jesper Juhl
2005-12-09 5:05 ` [netfilter-core] " 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
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox