Received: by 2002:a05:6a10:8c0a:0:0:0:0 with SMTP id go10csp918302pxb; Tue, 9 Feb 2021 16:40:04 -0800 (PST) X-Google-Smtp-Source: ABdhPJyO9rjXZwbRwNd5xpQz3tNEOLYsuNwUobqbTSP2WQVWD2e4kF8TupmZGEd2vs1/CsvWa/rz X-Received: by 2002:a05:6402:3510:: with SMTP id b16mr780520edd.242.1612917604197; Tue, 09 Feb 2021 16:40:04 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1612917604; cv=none; d=google.com; s=arc-20160816; b=KPnlLZtS2O7mEflvHTvUz5j9NYSRQI4+aUNkVKAQlK8XdqBOyor0XV0+oyBUa3tG27 nEuw+5lzxpsM3zqbJFHm5gjnflSmwu0CJ7kwJ9/gJx2KW6YXSSwEXwxUVTmAKQAEkIM6 OtfUsegQK/fYlZwNsbPwI8hYvvD+jk07b7yYWGR/x5e1IwgwOgN3b2SvUvzvo3g7xqt9 hdTKjc5qXFeb+E5sreuZ6DuebCci6LjOlM2QUiTXQJXxpz7s4j6dAjNvsu9qkimG0Jf+ lgwj0VyFKHqO2SooSZ0zHdD72TBd8dNyxK86hDTvLJvTteGwtankpmy/3F5GdMvzhOUp Mzdw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :references:in-reply-to:message-id:subject:reply-to:cc:from:to :dkim-signature:date; bh=85QQJNudKIF3Xtg97Y7g4QbqbeIMU4YL32cELilgRjM=; b=UuJV/+r8kGx28ebFWtfcEE+opASgvo34aYBMY7rI+X0sco9pMAz84+N1jMKRSs/JHy 9zaAR4BQDxO2lw/+fK0IzJIwb9RQbpv+XeQj7HD/WRMSR+PoSfdv2iCTpQfL0VYj3rZL eoqKUE43f8e11UMvPdlRZC7mLnoPuI5dm3YsF0cTk8LgZ6RolS8aR898gjx47joxXO9G 9IdDr3Y9TqBeJg6UnOJN20VBZ0PXUra3LctJLikSf32TxHTGgBFQo+/jptpvBJop5oj0 ArkvUrE5fKBhzoZ+2IKpa4/DlWyHjN9Dqpc89Agp9I0hNklAttVNUBKGgNECZC1y86iZ G3xw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@pm.me header.s=protonmail header.b=jhApZdmS; 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=pm.me Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id d9si299629edt.564.2021.02.09.16.39.41; Tue, 09 Feb 2021 16:40:04 -0800 (PST) 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=@pm.me header.s=protonmail header.b=jhApZdmS; 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=pm.me Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S234193AbhBJAhI (ORCPT + 99 others); Tue, 9 Feb 2021 19:37:08 -0500 Received: from mail-40136.protonmail.ch ([185.70.40.136]:54445 "EHLO mail-40136.protonmail.ch" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S233767AbhBIUtQ (ORCPT ); Tue, 9 Feb 2021 15:49:16 -0500 Date: Tue, 09 Feb 2021 20:48:14 +0000 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=pm.me; s=protonmail; t=1612903699; bh=85QQJNudKIF3Xtg97Y7g4QbqbeIMU4YL32cELilgRjM=; h=Date:To:From:Cc:Reply-To:Subject:In-Reply-To:References:From; b=jhApZdmS2S6jhwoIFR1qFMrJ6Ar22V773Peax4i31bvsu8PZ9fepGhgyUjViJmVhS 7Xf5ZdSVsTMVkg8neW2VcsC8HSTrUjsSoLCvW/+KCp1HfitZdYSuYafr7U7YlatlP1 E2MO4pNbPYQ9ztadhoqkSrfN9Kbl8nROfOZmQISwoTSo979kbbfKJ1n/y83Gj7oHsn OnSLcwikPEpLi78JUssBc2v+gEoA/RFkplg4sO0iulkPxhLosp87I+ar9ypnRJLMTu p4wG38GmF9XhNW1HNCpvliQv2lyBb6uZpyPXChyhFugUsX3lZiOn5qOV8VcOBrF2lp lvfyBv34dYsXg== To: "David S. Miller" , Jakub Kicinski From: Alexander Lobakin Cc: Jonathan Lemon , Eric Dumazet , Dmitry Vyukov , Willem de Bruijn , Alexander Lobakin , Randy Dunlap , Kevin Hao , Pablo Neira Ayuso , Jakub Sitnicki , Marco Elver , Dexuan Cui , Paolo Abeni , Alexei Starovoitov , Daniel Borkmann , Andrii Nakryiko , Taehee Yoo , Cong Wang , =?utf-8?Q?Bj=C3=B6rn_T=C3=B6pel?= , Miaohe Lin , Guillaume Nault , Yonghong Song , zhudi , Michal Kubecek , Marcelo Ricardo Leitner , Dmitry Safonov <0x7f454c46@gmail.com>, Yang Yingliang , linux-kernel@vger.kernel.org, netdev@vger.kernel.org Reply-To: Alexander Lobakin Subject: [v3 net-next 05/10] skbuff: use __build_skb_around() in __alloc_skb() Message-ID: <20210209204533.327360-6-alobakin@pm.me> In-Reply-To: <20210209204533.327360-1-alobakin@pm.me> References: <20210209204533.327360-1-alobakin@pm.me> MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: quoted-printable X-Spam-Status: No, score=-1.2 required=10.0 tests=ALL_TRUSTED,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF shortcircuit=no autolearn=disabled version=3.4.4 X-Spam-Checker-Version: SpamAssassin 3.4.4 (2020-01-24) on mailout.protonmail.ch Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Just call __build_skb_around() instead of open-coding it. Signed-off-by: Alexander Lobakin --- net/core/skbuff.c | 18 +----------------- 1 file changed, 1 insertion(+), 17 deletions(-) diff --git a/net/core/skbuff.c b/net/core/skbuff.c index 88566de26cd1..1c6f6ef70339 100644 --- a/net/core/skbuff.c +++ b/net/core/skbuff.c @@ -326,7 +326,6 @@ struct sk_buff *__alloc_skb(unsigned int size, gfp_t gf= p_mask, =09=09=09 int flags, int node) { =09struct kmem_cache *cache; -=09struct skb_shared_info *shinfo; =09struct sk_buff *skb; =09u8 *data; =09bool pfmemalloc; @@ -366,21 +365,8 @@ struct sk_buff *__alloc_skb(unsigned int size, gfp_t g= fp_mask, =09 * the tail pointer in struct sk_buff! =09 */ =09memset(skb, 0, offsetof(struct sk_buff, tail)); -=09/* Account for allocated memory : skb + skb->head */ -=09skb->truesize =3D SKB_TRUESIZE(size); +=09__build_skb_around(skb, data, 0); =09skb->pfmemalloc =3D pfmemalloc; -=09refcount_set(&skb->users, 1); -=09skb->head =3D data; -=09skb->data =3D data; -=09skb_reset_tail_pointer(skb); -=09skb->end =3D skb->tail + size; -=09skb->mac_header =3D (typeof(skb->mac_header))~0U; -=09skb->transport_header =3D (typeof(skb->transport_header))~0U; - -=09/* make sure we initialize shinfo sequentially */ -=09shinfo =3D skb_shinfo(skb); -=09memset(shinfo, 0, offsetof(struct skb_shared_info, dataref)); -=09atomic_set(&shinfo->dataref, 1); =20 =09if (flags & SKB_ALLOC_FCLONE) { =09=09struct sk_buff_fclones *fclones; @@ -393,8 +379,6 @@ struct sk_buff *__alloc_skb(unsigned int size, gfp_t gf= p_mask, =09=09fclones->skb2.fclone =3D SKB_FCLONE_CLONE; =09} =20 -=09skb_set_kcov_handle(skb, kcov_common_handle()); - =09return skb; =20 nodata: --=20 2.30.0