From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-12.3 required=3.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,HEADER_FROM_DIFFERENT_DOMAINS,INCLUDES_PATCH, MAILING_LIST_MULTI,SPF_HELO_NONE,SPF_PASS,URIBL_BLOCKED,USER_AGENT_SANE_1 autolearn=unavailable autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 23417C07E99 for ; Mon, 12 Jul 2021 13:26:53 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id 0DEA3610CB for ; Mon, 12 Jul 2021 13:26:53 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S233967AbhGLN3j (ORCPT ); Mon, 12 Jul 2021 09:29:39 -0400 Received: from relay.sw.ru ([185.231.240.75]:49562 "EHLO relay.sw.ru" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S230210AbhGLN3g (ORCPT ); Mon, 12 Jul 2021 09:29:36 -0400 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=virtuozzo.com; s=relay; h=Content-Type:MIME-Version:Date:Message-ID:Subject :From; bh=tsW93LKYsNwVYesCYjOwJko0OG56avvmHsNuF/Nk5SA=; b=EQ6wutd32AQNESjSR/Q 4YQCZM+lubNVPm4LNJ3GKPgmjrVQNDEaw0xUKaq9+dU1p1r5Swr004UfmXkes+PKrpeEcBTeXBJFE Nb2lUZBGi/N0qtww+YY70vdA6SI2UG+Su9H42CaNf1xmdIX0o/q7Igg3+0cWckhjoZA92p4fDwk=; Received: from [10.93.0.56] by relay.sw.ru with esmtp (Exim 4.94.2) (envelope-from ) id 1m2vxH-003iBx-FX; Mon, 12 Jul 2021 16:26:39 +0300 From: Vasily Averin Subject: [PATCH NET 0/7] skbuff: introduce pskb_realloc_headroom() To: "David S. Miller" , Hideaki YOSHIFUJI , David Ahern , Jakub Kicinski , Eric Dumazet Cc: netdev@vger.kernel.org, Joerg Reuter , Ralf Baechle , linux-hams@vger.kernel.org, Alexei Starovoitov , Daniel Borkmann , Andrii Nakryiko , Martin KaFai Lau , Song Liu , Yonghong Song , KP Singh , bpf@vger.kernel.org, linux-kernel@vger.kernel.org References: <74e90fba-df9f-5078-13de-41df54d2b257@virtuozzo.com> Message-ID: <02202ac2-4cd8-4fea-290f-e49fb83eeb07@virtuozzo.com> Date: Mon, 12 Jul 2021 16:26:38 +0300 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:78.0) Gecko/20100101 Thunderbird/78.11.0 MIME-Version: 1.0 In-Reply-To: <74e90fba-df9f-5078-13de-41df54d2b257@virtuozzo.com> Content-Type: text/plain; charset=utf-8 Content-Language: en-US Content-Transfer-Encoding: 7bit Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org currently if skb does not have enough headroom skb_realloc_headrom is called. It is not optimal because it creates new skb. Unlike skb_realloc_headroom, new helper pskb_realloc_headroom does not allocate a new skb if possible; copies skb->sk on new skb when as needed and frees original skb in case of failures. This helps to simplify ip[6]_finish_output2(), ip6_xmit() and a few other functions in vrf, ax25 and bpf. There are few other cases where this helper can be used but they require an additional investigations. NB: patch "ipv6: use pskb_realloc_headroom in ip6_finish_output2" depends on patch "ipv6: allocate enough headroom in ip6_finish_output2()" submitted separately https://lkml.org/lkml/2021/7/12/732 Vasily Averin (7): skbuff: introduce pskb_realloc_headroom() ipv6: use pskb_realloc_headroom in ip6_finish_output2 ipv6: use pskb_realloc_headroom in ip6_xmit ipv4: use pskb_realloc_headroom in ip_finish_output2 vrf: use pskb_realloc_headroom in vrf_finish_output ax25: use pskb_realloc_headroom bpf: use pskb_realloc_headroom in bpf_out_neigh_v4/6 drivers/net/vrf.c | 14 +++------ include/linux/skbuff.h | 2 ++ net/ax25/ax25_out.c | 13 +++------ net/ax25/ax25_route.c | 13 +++------ net/core/filter.c | 22 +++----------- net/core/skbuff.c | 41 ++++++++++++++++++++++++++ net/ipv4/ip_output.c | 12 ++------ net/ipv6/ip6_output.c | 78 ++++++++++++++++++-------------------------------- 8 files changed, 89 insertions(+), 106 deletions(-) -- 1.8.3.1