[PATCH]: 1st step to remove skb_linearize() in ip6_tables.c and optimization

Patrick McHardy kaber@trash.net
Tue, 06 Jul 2004 12:20:23 +0200


Harald Welte wrote:
> On Thu, Jun 24, 2004 at 01:26:10PM +0200, Patrick McHardy wrote:
> 
>>Think of 100 rules matching "-p tcp --dport X". We copy the tcp header
>>100 times, for a total of 2000 bytes. 
> 
> 
> but we're talking about local copies to the stack.  those copies are 20
> byte copies to the cache, and most likely would never have to hit memory
> at all.  

I did some profiling:

1000 non-matching rules for tcp-sport, ~40mbit tcp transfer, about 10
minutes

The top three entries are:

CPU: Athlon, speed 1667.51 MHz (estimated)
Counted CPU_CLK_UNHALTED events (Cycles outside of halt state) with a 
unit mask of 0x00 (No unit mask) count 100000
samples  %        linenr info                 image name 
app name                 symbol name
3489310  50.0932  (no location information)   ip_tables.ko 
ip_tables                ipt_do_table
1405809  20.1821  skbuff.c:858                vmlinux 
vmlinux                  skb_copy_bits
755945   10.8525  ip_tables.c:1488            ip_tables.ko 
ip_tables                tcp_match

skb_copy_bits is taking about twice as much cycles as tcp_match
and 20% of total cycles.

Regards
Patrick