Received: by 2002:a05:6a10:c7c6:0:0:0:0 with SMTP id h6csp1455030pxy; Mon, 2 Aug 2021 01:53:59 -0700 (PDT) X-Google-Smtp-Source: ABdhPJyb3Pb24TT2CSCxWU0DAvy9BNF//KkIzALmicm+2jvYuMR+xrYYvtv9MrDgVUDLWWK5+Cp2 X-Received: by 2002:a05:6402:b6e:: with SMTP id cb14mr11990530edb.239.1627894439125; Mon, 02 Aug 2021 01:53:59 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1627894439; cv=none; d=google.com; s=arc-20160816; b=OZtTIrEPSH0OIq7q+QAuSIJeeVNPbGgHz2KqBFbK62zPiGpvV8upbeUrUe7TBPgTOF bhX3ASQPTm/y1+CT3CimCIHB2gtBu8pVU+Aai85Tko+4vAHKi2pfN0vo6aNrVDxOpwb5 Gqae4LNp36NOjjkcwpixT2SLeN//QVfYS4dYa11yEB9cvSO5RP7svn9/UQ9k0ClE16ea k9vAndy2SSndHheQqlOBufb6cT1AOrF9tHrkItbd69IxgMH4C/0+wOY/M6EbG21Ywkdu 7866v1OvZZnxRciqWVK6xDnk8U+xmeNSda4WPNuVlxkolXpheT1AMPSJK3fD5MrWc7cx cXJA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:content-language :in-reply-to:mime-version:user-agent:date:message-id:references:cc :to:subject:from:dkim-signature; bh=iZalwKKRF7cBwjAJmDHOFv5MqOcJkgfwIJ4xQNpZEZo=; b=EoS5if0hiuc72AN3G+c3OkIleBX4Z5sY3C8O0mwe0WWwo91bw7wkWTx9ipKeQbH1Vo DJB1khPhrtSZWU9hxYGewrdw6PXZsRWwgnlok5eV4zqLurnlIaoPOxKUPSNvSA3L/BRt 0fqrDzPMDP7pJvBHHhik8TMTDDDkx6iwLNQFc81F2YVMUQk05wnWubpVQhPNC13XWtb7 c45Sb4ob7QqmNcFgimbWWZQLQAhYMWeeXMgqug/VfTru21H+PWWbB4YznaOpppXkemO+ emoQCSE/x4WyqSQ+g0vK+5bYsOmg36uI0wETDGpfOA94N0XpfxIPr/hOAClTMYPmG/uD 8HXA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@virtuozzo.com header.s=relay header.b=aUiQcSe7; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=QUARANTINE sp=QUARANTINE dis=NONE) header.from=virtuozzo.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id du3si10249855ejc.406.2021.08.02.01.53.35; Mon, 02 Aug 2021 01:53:59 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; dkim=pass header.i=@virtuozzo.com header.s=relay header.b=aUiQcSe7; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=QUARANTINE sp=QUARANTINE dis=NONE) header.from=virtuozzo.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S232856AbhHBIwZ (ORCPT + 99 others); Mon, 2 Aug 2021 04:52:25 -0400 Received: from relay.sw.ru ([185.231.240.75]:44312 "EHLO relay.sw.ru" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S232711AbhHBIwY (ORCPT ); Mon, 2 Aug 2021 04:52:24 -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=iZalwKKRF7cBwjAJmDHOFv5MqOcJkgfwIJ4xQNpZEZo=; b=aUiQcSe703uzPp04bWp c01e+RnR9s0jPQmP9819VzZmrY4TW5RKsXiYvegTbQgDGpsURjt3ov2omkUypyQxD6Pfc+y0phAKh 8M3VfmOdRiP7SWec5Okl/ZBSRgiqOMeVT3z74SrXkMrBsLp/V7dllkgJffcJhfP5DUrH9RL+POU=; Received: from [10.93.0.56] by relay.sw.ru with esmtp (Exim 4.94.2) (envelope-from ) id 1mATg9-0060Mi-DF; Mon, 02 Aug 2021 11:52:09 +0300 From: Vasily Averin Subject: [PATCH NET v3 0/7] skbuff: introduce skb_expand_head() 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: <15eba3b2-80e2-5547-8ad9-167d810ad7e3@virtuozzo.com> Message-ID: Date: Mon, 2 Aug 2021 11:52:08 +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: <15eba3b2-80e2-5547-8ad9-167d810ad7e3@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. this patch set introduces new helper skb_expand_head() Unlike skb_realloc_headroom, it 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 few other functions in vrf, ax25 and bpf. There are few other cases where this helper can be used but it requires an additional investigations. v3 changes: - ax25 compilation warning fixed - v5.14-rc4 rebase - now it does not depend on non-committed pathces v2 changes: - helper's name was changed to skb_expand_head - fixed few mistakes inside skb_expand_head(): skb_set_owner_w should set sk on nskb kfree was replaced by kfree_skb() improved warning message - added minor refactoring in changed functions in vrf and bpf patches - removed kfree_skb() in ax25_rt_build_path caller ax25_ip_xmit Vasily Averin (7): skbuff: introduce skb_expand_head() ipv6: use skb_expand_head in ip6_finish_output2 ipv6: use skb_expand_head in ip6_xmit ipv4: use skb_expand_head in ip_finish_output2 vrf: use skb_expand_head in vrf_finish_output ax25: use skb_expand_head bpf: use skb_expand_head in bpf_out_neigh_v4/6 drivers/net/vrf.c | 21 +++++--------- include/linux/skbuff.h | 1 + net/ax25/ax25_ip.c | 4 +-- net/ax25/ax25_out.c | 13 ++------- net/ax25/ax25_route.c | 13 ++------- net/core/filter.c | 27 ++++------------- net/core/skbuff.c | 42 +++++++++++++++++++++++++++ net/ipv4/ip_output.c | 13 ++------- net/ipv6/ip6_output.c | 78 +++++++++++++++++--------------------------------- 9 files changed, 91 insertions(+), 121 deletions(-) -- 1.8.3.1