dect
/
linux-2.6
Archived
13
0
Fork 0
This repository has been archived on 2022-02-17. You can view files and clone it, but cannot push or open issues or pull requests.
linux-2.6/include
Patrick McHardy 334a8132d9 [SKBUFF]: Keep track of writable header len of headerless clones
Currently NAT (and others) that want to modify cloned skbs copy them,
even if in the vast majority of cases its not necessary because the
skb is a clone made by TCP and the portion NAT wants to modify is
actually writable because TCP release the header reference before
cloning.

The problem is that there is no clean way for NAT to find out how
long the writable header area is, so this patch introduces skb->hdr_len
to hold this length. When a headerless skb is cloned skb->hdr_len
is set to the current headroom, for regular clones it is copied from
the original. A new function skb_clone_writable(skb, len) returns
whether the skb is writable up to len bytes from skb->data. To avoid
enlarging the skb the mac_len field is reduced to 16 bit and the
new hdr_len field is put in the remaining 16 bit.

I've done a few rough benchmarks of NAT (not with this exact patch,
but a very similar one). As expected it saves huge amounts of system
time in case of sendfile, bringing it down to basically the same
amount as without NAT, with sendmsg it only helps on loopback,
probably because of the large MTU.

Transmit a 1GB file using sendfile/sendmsg over eth0/lo with and
without NAT:

- sendfile eth0, no NAT:	sys     0m0.388s
- sendfile eth0, NAT:		sys     0m1.835s
- sendfile eth0: NAT + path:	sys     0m0.370s	(~ -80%)

- sendfile lo, no NAT:		sys     0m0.258s
- sendfile lo, NAT:		sys     0m2.609s
- sendfile lo, NAT + patch:	sys     0m0.260s	(~ -90%)

- sendmsg eth0, no NAT:		sys     0m2.508s
- sendmsg eth0, NAT:		sys     0m2.539s
- sendmsg eth0, NAT + patch:	sys     0m2.445s	(no change)

- sendmsg lo, no NAT:		sys	0m2.151s
- sendmsg lo, NAT:		sys     0m3.557s
- sendmsg lo, NAT + patch:	sys     0m2.159s	(~ -40%)

I expect other users can see a similar performance improvement,
packet mangling iptables targets, ipip and ip_gre come to mind ..

Signed-off-by: Patrick McHardy <kaber@trash.net>
Signed-off-by: David S. Miller <davem@davemloft.net>
2007-07-10 22:15:37 -07:00
..
acpi Pull osi-now into release branch 2007-06-02 01:02:09 -04:00
asm-alpha ALPHA: misc fixes 2007-06-01 08:18:29 -07:00
asm-arm Introduce fixed sys_sync_file_range2() syscall, implement on PowerPC and ARM 2007-06-28 11:38:30 -07:00
asm-arm26 lots-of-architectures: enable arbitary speed tty support 2007-07-10 17:51:13 -07:00
asm-avr32 lots-of-architectures: enable arbitary speed tty support 2007-07-10 17:51:13 -07:00
asm-blackfin lots-of-architectures: enable arbitary speed tty support 2007-07-10 17:51:13 -07:00
asm-cris lots-of-architectures: enable arbitary speed tty support 2007-07-10 17:51:13 -07:00
asm-frv lots-of-architectures: enable arbitary speed tty support 2007-07-10 17:51:13 -07:00
asm-generic sched: simplify sched_find_first_bit() 2007-07-09 18:52:00 +02:00
asm-h8300 lots-of-architectures: enable arbitary speed tty support 2007-07-10 17:51:13 -07:00
asm-i386 i386: es7000 build breakage fix 2007-07-06 10:23:43 -07:00
asm-ia64 lots-of-architectures: enable arbitary speed tty support 2007-07-10 17:51:13 -07:00
asm-m32r lots-of-architectures: enable arbitary speed tty support 2007-07-10 17:51:13 -07:00
asm-m68k lots-of-architectures: enable arbitary speed tty support 2007-07-10 17:51:13 -07:00
asm-m68knommu Remove tas() 2007-05-08 11:15:20 -07:00
asm-mips lots-of-architectures: enable arbitary speed tty support 2007-07-10 17:51:13 -07:00
asm-parisc lots-of-architectures: enable arbitary speed tty support 2007-07-10 17:51:13 -07:00
asm-powerpc [POWERPC] Uninline and export virq_to_hw() for the pasemi_mac driver 2007-07-02 13:29:21 +10:00
asm-ppc Rework ptep_set_access_flags and fix sun4c 2007-06-16 13:16:16 -07:00
asm-s390 lots-of-architectures: enable arbitary speed tty support 2007-07-10 17:51:13 -07:00
asm-sh lots-of-architectures: enable arbitary speed tty support 2007-07-10 17:51:13 -07:00
asm-sh64 sh64: generic quicklist support. 2007-05-14 09:55:35 +09:00
asm-sparc Rework ptep_set_access_flags and fix sun4c 2007-06-16 13:16:16 -07:00
asm-sparc64 [SPARC64]: Add linux/pagemap.h to asm/tlb.h 2007-06-28 21:25:31 -07:00
asm-um uml: add asm/paravirt.h 2007-06-24 08:59:11 -07:00
asm-v850 lots-of-architectures: enable arbitary speed tty support 2007-07-10 17:51:13 -07:00
asm-x86_64 x86_64: Fix eventd/timerfd syscalls 2007-06-20 14:27:25 -07:00
asm-xtensa lots-of-architectures: enable arbitary speed tty support 2007-07-10 17:51:13 -07:00
crypto
keys
linux [SKBUFF]: Keep track of writable header len of headerless clones 2007-07-10 22:15:37 -07:00
math-emu Delete unused header file math-emu/extended.h 2007-05-08 11:15:05 -07:00
media V4L/DVB (5592): DMA: Correctly free resources on error, sync PCI streamed data 2007-05-09 10:12:42 -03:00
mtd
net [RTNETLINK]: Link creation API 2007-07-10 22:14:20 -07:00
pcmcia PCMCIA-NETDEV : add new ID of lan&modem multifunction card 2007-07-08 22:16:39 -04:00
rdma Merge branch 'for-linus' of master.kernel.org:/pub/scm/linux/kernel/git/roland/infiniband 2007-05-21 16:19:32 -07:00
rxrpc
scsi [SCSI] sas_scsi_host: Convert to use the kthread API 2007-05-06 09:33:17 -05:00
sound [ALSA] version 1.0.14 2007-05-31 11:03:27 +02:00
video atmel_lcdfb: AT91/AT32 LCD Controller framebuffer driver 2007-05-11 08:29:37 -07:00
Kbuild