aboutsummaryrefslogtreecommitdiffstats
path: root/net/ipv4
diff options
context:
space:
mode:
authorDavid S. Miller <davem@davemloft.net>2005-08-17 17:57:30 -0400
committerDavid S. Miller <davem@sunset.davemloft.net>2005-08-29 19:01:54 -0400
commitd179cd12928443f3ec29cfbc3567439644bd0afc (patch)
tree0bfc57e73f0bf9f7bb9d5c8ce7d3d5afe550f94e /net/ipv4
parente92ae93a8aa66aea12935420cb22d4df1c18d023 (diff)
[NET]: Implement SKB fast cloning.
Protocols that make extensive use of SKB cloning, for example TCP, eat at least 2 allocations per packet sent as a result. To cut the kmalloc() count in half, we implement a pre-allocation scheme wherein we allocate 2 sk_buff objects in advance, then use a simple reference count to free up the memory at the correct time. Based upon an initial patch by Thomas Graf and suggestions from Herbert Xu. Signed-off-by: David S. Miller <davem@davemloft.net>
Diffstat (limited to 'net/ipv4')
-rw-r--r--net/ipv4/tcp_output.c4
1 files changed, 2 insertions, 2 deletions
diff --git a/net/ipv4/tcp_output.c b/net/ipv4/tcp_output.c
index 8d92ab562aed..75b68116682a 100644
--- a/net/ipv4/tcp_output.c
+++ b/net/ipv4/tcp_output.c
@@ -1582,7 +1582,7 @@ void tcp_send_fin(struct sock *sk)
1582 } else { 1582 } else {
1583 /* Socket is locked, keep trying until memory is available. */ 1583 /* Socket is locked, keep trying until memory is available. */
1584 for (;;) { 1584 for (;;) {
1585 skb = alloc_skb(MAX_TCP_HEADER, GFP_KERNEL); 1585 skb = alloc_skb_fclone(MAX_TCP_HEADER, GFP_KERNEL);
1586 if (skb) 1586 if (skb)
1587 break; 1587 break;
1588 yield(); 1588 yield();
@@ -1804,7 +1804,7 @@ int tcp_connect(struct sock *sk)
1804 1804
1805 tcp_connect_init(sk); 1805 tcp_connect_init(sk);
1806 1806
1807 buff = alloc_skb(MAX_TCP_HEADER + 15, sk->sk_allocation); 1807 buff = alloc_skb_fclone(MAX_TCP_HEADER + 15, sk->sk_allocation);
1808 if (unlikely(buff == NULL)) 1808 if (unlikely(buff == NULL))
1809 return -ENOBUFS; 1809 return -ENOBUFS;
1810 1810