From: Herbert Xu <herbert@gondor.apana.org.au> Date: Thu, 15 Nov 2007 14:29:39 +0800I was just about to mention this and what I think we should do instead is keep the SKB_WITH_OVERHEAD calculation fix in there (it fixes a serious bug which users are hitting) and add the fix for the second bug fix this round as well. Therefore, Greg please keep the patch add the following one as it will address all of the issues. [TCP]: Fix size calculation in sk_stream_alloc_pskb [ Upstream commit: fb93134dfc2a6e6fbedc7c270a31da03fce88db9 ] We round up the header size in sk_stream_alloc_pskb so that TSO packets get zero tail room. Unfortunately this rounding up is not coordinated with the select_size() function used by TCP to calculate the second parameter of sk_stream_alloc_pskb. As a result, we may allocate more than a page of data in the non-TSO case when exactly one page is desired. In fact, rounding up the head room is detrimental in the non-TSO case because it makes memory that would otherwise be available to the payload head room. TSO doesn't need this either, all it wants is the guarantee that there is no tail room. So this patch fixes this by adjusting the skb_reserve call so that exactly the requested amount (which all callers have calculated in a precise way) is made available as tail room. Signed-off-by: Herbert Xu <herbert@gondor.apana.org.au> Signed-off-by: David S. Miller <davem@davemloft.net> diff --git a/include/net/sock.h b/include/net/sock.h index 5504fb9..567e468 100644 --- a/include/net/sock.h +++ b/include/net/sock.h @@ -1235,14 +1235,16 @@ static inline struct sk_buff *sk_stream_alloc_pskb(struct sock *sk, gfp_t gfp) { struct sk_buff *skb; - int hdr_len; - hdr_len = SKB_DATA_ALIGN(sk->sk_prot->max_header); - skb = alloc_skb_fclone(size + hdr_len, gfp); + skb = alloc_skb_fclone(size + sk->sk_prot->max_header, gfp); if (skb) { skb->truesize += mem; if (sk_stream_wmem_schedule(sk, skb->truesize)) { - skb_reserve(skb, hdr_len); + /* + * Make sure that we have exactly size bytes + * available to the caller, no more, no less. + */ + skb_reserve(skb, skb_tailroom(skb) - size); return skb; } __kfree_skb(skb); -
| Ingo Molnar | Re: [patch] paravirt: VDSO page is essential |
| Johannes Weiner | Re: Versioning file system |
| Matt Mackall | [PATCH 1/13] maps: Uninline some functions in the page walker |
| Greg KH | [patch 00/49] 2.6.25-stable review |
git: | |
| Johannes Schindelin | Re: [PATCH 1/4] Move redo merge code in a function |
| Dmitry Potapov | Re: [RFC] Git User's Survey 2008 |
| Johannes Schindelin | Re: [PATCH] Teach 'git apply' to look at $GIT_DIR/config |
| Shawn O. Pearce | Re: [kernel.org users] [RFD] On deprecating "git-foo" for builtins |
| Brian A. Seklecki | sshd_config(5) PermitRootLogin yes |
| Richard Stallman | Real men don't attack straw men |
| ropers | Re: low-MHz server |
| Diego Fernando Nieto Moreno | Intel DG33 Support |
| Holger Schurig | Re: Linux Wireless Mini-Summit -- Ottawa -- July 22, 2008 |
| Tilman Schmidt | Re: 2.6.25-rc8: FTP transfer errors |
| Eric Dumazet | Re: [rfc][patch 3/3] use SLAB_ALIGN_SMP |
| Lennert Buytenhek | [PATCH 21/39] mv643xx_eth: move port_receive() into its only caller |
| high memory | 13 hours ago | Linux kernel |
| semaphore access speed | 16 hours ago | Applications and Utilities |
| the kernel how to power off the machine | 17 hours ago | Linux kernel |
| Easter Eggs in windows XP | 20 hours ago | Windows |
| Shared swap partition | 21 hours ago | Linux general |
| Root password | 21 hours ago | Linux general |
| Where/when DNOTIFY is used? | 23 hours ago | Linux kernel |
| How to convert Linux Kernel built-in module into a loadable module | 1 day ago | Linux kernel |
| Linux 2.6.24 and I/O schedulers | 1 day ago | Linux kernel |
| USB Driver -- Interrupt Polling -- A Little Help Please | 1 day ago | Linux general |
