mirror of
https://github.com/BobTheBlinker/android_kernel_motorola_sm6375.git
synced 2026-10-28 18:51:56 -04:00
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 <[email protected]> CC: Andi Kleen <[email protected]> CC: Ben Hutchings <[email protected]> Signed-off-by: David S. Miller <[email protected]>
This commit is contained in:
parent
97ba0eb64c
commit
87fb4b7b53
8 changed files with 32 additions and 19 deletions
|
|
@ -1819,7 +1819,7 @@ static void iucv_callback_rx(struct iucv_path *path, struct iucv_message *msg)
|
|||
goto save_message;
|
||||
|
||||
len = atomic_read(&sk->sk_rmem_alloc);
|
||||
len += iucv_msg_length(msg) + sizeof(struct sk_buff);
|
||||
len += SKB_TRUESIZE(iucv_msg_length(msg));
|
||||
if (len > sk->sk_rcvbuf)
|
||||
goto save_message;
|
||||
|
||||
|
|
|
|||
Loading…
Reference in a new issue