net: allow pskb_expand_head() to get maximum tailroom
Marc Merlin reported many order-1 allocations failures in TX path on its wireless setup, that dont make any sense with MTU=1500 network, and non SG capable hardware. Turns out part of the problem comes from pskb_expand_head() not using ksize() to get exact head size given by kmalloc(). Doing the same thing than __alloc_skb() allows more tailroom in skb and can prevent future reallocations. As a bonus, struct skb_shared_info becomes cache line aligned. Reported-by: Marc MERLIN <marc@merlins.org> Tested-by: Marc MERLIN <marc@merlins.org> Signed-off-by: Eric Dumazet <eric.dumazet@gmail.com> Signed-off-by: David S. Miller <davem@davemloft.net>
This commit is contained in:
		
					parent
					
						
							
								996304bbea
							
						
					
				
			
			
				commit
				
					
						87151b8689
					
				
			
		
					 1 changed files with 3 additions and 1 deletions
				
			
		|  | @ -952,9 +952,11 @@ int pskb_expand_head(struct sk_buff *skb, int nhead, int ntail, | ||||||
| 		goto adjust_others; | 		goto adjust_others; | ||||||
| 	} | 	} | ||||||
| 
 | 
 | ||||||
| 	data = kmalloc(size + sizeof(struct skb_shared_info), gfp_mask); | 	data = kmalloc(size + SKB_DATA_ALIGN(sizeof(struct skb_shared_info)), | ||||||
|  | 		       gfp_mask); | ||||||
| 	if (!data) | 	if (!data) | ||||||
| 		goto nodata; | 		goto nodata; | ||||||
|  | 	size = SKB_WITH_OVERHEAD(ksize(data)); | ||||||
| 
 | 
 | ||||||
| 	/* Copy only real data... and, alas, header. This should be
 | 	/* Copy only real data... and, alas, header. This should be
 | ||||||
| 	 * optimized for the cases when header is void. | 	 * optimized for the cases when header is void. | ||||||
|  |  | ||||||
		Loading…
	
	Add table
		Add a link
		
	
		Reference in a new issue
	
	 Eric Dumazet
				Eric Dumazet