From: Jan Dakinevich <jan.dakinev...@virtuozzo.com> Preallocate required memory with reasoned flags and skip memory allocation step made by __pskb_pull_tail.
https://pmc.acronis.com/browse/VSTOR-22811 Signed-off-by: Jan Dakinevich <jan.dakinev...@virtuozzo.com> Acked-by: Konstantin Khorenko <khore...@virtuozzo.com> khorenko@: * skb buffer is provided to DMA zone, so allocation cannot be switched to kvmalloc(), so we just supress the warning here. * i40e_skb_linearize() code is taken from __pskb_pull_tail(), except for the size: we omit "+128" preallocation here because no future expansions are expected in this case. * there is another similar place: i40e_xmit_frame_ring() in i40evf/i40e_txrx.c, but as we did not trigger the warning there and as we just shut up the warning, we don't touch the second place in advance. https://jira.sw.ru/browse/PSBM-127846 (cherry-picked from vz7 commit 9b2d96420858 ("net/drivers/i40e: suppress warning on skb linearization")) Signed-off-by: Pavel Tikhomirov <ptikhomi...@virtuozzo.com> (cherry picked from vz8 commit ec1793e41ef5bffd082395bac3ace24a946d51ce) Signed-off-by: Andrey Zhadchenko <andrey.zhadche...@virtuozzo.com> --- drivers/net/ethernet/intel/i40e/i40e_txrx.c | 19 ++++++++++++++++++- 1 file changed, 18 insertions(+), 1 deletion(-) diff --git a/drivers/net/ethernet/intel/i40e/i40e_txrx.c b/drivers/net/ethernet/intel/i40e/i40e_txrx.c index 74143f3..084169d 100644 --- a/drivers/net/ethernet/intel/i40e/i40e_txrx.c +++ b/drivers/net/ethernet/intel/i40e/i40e_txrx.c @@ -3734,6 +3734,23 @@ static int i40e_xmit_xdp_ring(struct xdp_frame *xdpf, return I40E_XDP_TX; } + +static int i40e_skb_linearize(struct sk_buff *skb) +{ + int eat = (skb->tail + skb->data_len) - skb->end; + + /* workaround to avoid allocation without __GFP_ORDER_NOWARN inside + * __pskb_pull_tail() + */ + if (eat > 0 || skb_cloned(skb)) { + if (pskb_expand_head(skb, 0, eat > 0 ? eat : 0, + GFP_ATOMIC | __GFP_ORDER_NOWARN)) + return -ENOMEM; + } + + return __skb_linearize(skb); +} + /** * i40e_xmit_frame_ring - Sends buffer on Tx ring * @skb: send buffer @@ -3762,7 +3779,7 @@ static netdev_tx_t i40e_xmit_frame_ring(struct sk_buff *skb, count = i40e_xmit_descriptor_count(skb); if (i40e_chk_linearize(skb, count)) { - if (__skb_linearize(skb)) { + if (i40e_skb_linearize(skb)) { dev_kfree_skb_any(skb); return NETDEV_TX_OK; } -- 1.8.3.1 _______________________________________________ Devel mailing list Devel@openvz.org https://lists.openvz.org/mailman/listinfo/devel