Thread (7 messages) 7 messages, 3 authors, 2007-01-02

Re: [PATCH] net/core/flow.c: compare data with memcmp

From: Daniel Marjamäki <hidden>
Date: 2007-01-01 07:47:50
Also in: kernel-janitors, lkml

Hello!

So you mean that in this particular case it's faster with a handcoded
comparison than memcmp? Because both key1 and key2 are located at
word-aligned addresses?
That's fascinating.

Best regards,
Daniel

2006/12/31, David Miller [off-list ref]:
From: "Daniel_Marjamäki" <redacted>
Date: Sun, 31 Dec 2006 17:37:05 +0100
quoted
From: Daniel Marjamäki
This has been tested by me.
Signed-off-by: Daniel Marjamäki <redacted>
Please do not do this.

memcmp() cannot assume the alignment of the source and
destination buffers and thus will run more slowly than
that open-coded comparison.

That code was done like that on purpose because it is
one of the most critical paths in the networking flow
cache lookup which runs for every IPSEC packet going
throught the system.
Keyboard shortcuts
hback out one level
jnext message in thread
kprevious message in thread
ldrill in
Escclose help / fold thread tree
?toggle this help