Eric Dumazet 87fb4b7b53 net: more accurate skb truesize
skb truesize currently accounts for sk_buff struct and part of skb head.
kmalloc() roundings are also ignored.

Considering that skb_shared_info is larger than sk_buff, its time to
take it into account for better memory accounting.

This patch introduces SKB_TRUESIZE(X) macro to centralize various
assumptions into a single place.

At skb alloc phase, we put skb_shared_info struct at the exact end of
skb head, to allow a better use of memory (lowering number of
reallocations), since kmalloc() gives us power-of-two memory blocks.

Unless SLUB/SLUB debug is active, both skb->head and skb_shared_info are
aligned to cache lines, as before.

Note: This patch might trigger performance regressions because of
misconfigured protocol stacks, hitting per socket or global memory
limits that were previously not reached. But its a necessary step for a
more accurate memory accounting.

Signed-off-by: Eric Dumazet <eric.dumazet@gmail.com>
CC: Andi Kleen <ak@linux.intel.com>
CC: Ben Hutchings <bhutchings@solarflare.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
2011-10-13 16:05:07 -04:00
..
2011-04-22 11:04:14 -07:00
2011-04-22 11:04:14 -07:00
2011-03-12 15:08:49 -08:00
2011-10-13 16:05:07 -04:00
2011-08-24 17:52:11 -07:00
2011-05-12 23:03:46 -04:00
2011-07-01 16:11:15 -07:00
2011-08-12 02:55:28 -07:00
2011-02-01 15:35:25 -08:00
2011-06-08 17:05:30 -07:00
2011-10-13 16:05:07 -04:00
2011-03-31 11:26:23 -03:00
2011-09-27 13:25:05 -04:00
2011-03-31 11:26:23 -03:00
2011-10-03 14:01:21 -04:00
2010-10-27 11:37:32 -07:00
2010-07-12 12:57:54 -07:00