Received: by 2002:a05:6a10:8c0a:0:0:0:0 with SMTP id go10csp1453062pxb; Wed, 10 Feb 2021 08:39:31 -0800 (PST) X-Google-Smtp-Source: ABdhPJy+BK2LjoMPBVoel/CYT+zDSlWEkLwpQfNKjMGWjEjXfYJlkrkTPirnmw3FBLM8KwXFp6CL X-Received: by 2002:a50:bc14:: with SMTP id j20mr3870932edh.381.1612975170966; Wed, 10 Feb 2021 08:39:30 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1612975170; cv=none; d=google.com; s=arc-20160816; b=q/wI8xaQ+5Ry4u5FOE25/6+RwCxzOscsxd9VdHhoJhNUGdcUoSDD1MHhkuRl6vZIcz 7GLD9CK7zFcA0nFFPula5nPeDwNDFR//kR/5nqRK++rgrG9lExCy0IrK47H3w+6fXovf gfE0kAOteumarWUHDtfw8tmCNGdFHveBKIDd/aORBa00hq9zddVhp/Lag+JR9abmhPjQ eRyVPxPYy418WOArSk+fatQsw76J17Wja0YFNztImD5tXZa/exHFSCzYqUH0gQO9oN4M tUktTan2ndRQOdO9umrQvFV/9D80r/ixBMj8Y5OmWnIEDNNohD317BBCCS7YFRNxg9bb 9ONg== 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=9n7R30ez+8NGaLh1O893hoIhJlElIMgk5xtfqPCBjQ8=; b=gzwp7Hr4SCMscLFpJkLfMW/ze1AnEQkjG1hvz2ak57TLRohnow8trNL3I+MjfK9xnc g+TZMCauKrLnOWzojIg2c+gqWOf4tdJoqhWSgzTvz2EWjswdKLvfFBK4ZLzp8kt6nUDM oouq8eS/HYJ0v2RXgdzeea83T028wnUWdyQ+uzZxY35ItqkvplmxDz1CZyxDWmlVZ0L8 xZjBfv+qh4LB2d0nCdSgBOGVaQvVhkA4ZY9FFYYYti36AUkafAKIwNVp5p+nPNt9JwVr 78+tqe0AnQLAQrjYDEUXlamPKd1QmPYk4te4Xtr9XcVWIa9Z4dXRqk2wyxPQqIAcXxV9 c2Ig== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@pm.me header.s=protonmail header.b=fT7wZmVw; 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 a4si1518219ejx.563.2021.02.10.08.39.06; Wed, 10 Feb 2021 08:39:30 -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=fT7wZmVw; 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 S232682AbhBJQgY (ORCPT + 99 others); Wed, 10 Feb 2021 11:36:24 -0500 Received: from mail-40136.protonmail.ch ([185.70.40.136]:33558 "EHLO mail-40136.protonmail.ch" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S232579AbhBJQb0 (ORCPT ); Wed, 10 Feb 2021 11:31:26 -0500 Date: Wed, 10 Feb 2021 16:29:38 +0000 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=pm.me; s=protonmail; t=1612974587; bh=9n7R30ez+8NGaLh1O893hoIhJlElIMgk5xtfqPCBjQ8=; h=Date:To:From:Cc:Reply-To:Subject:In-Reply-To:References:From; b=fT7wZmVwnEnV9lfYQgwyVu8GDUa8OgXuJ+fkoS7xmEUh4eMzpCEsVr3pOyuvNt+9v JhxUsYBYx0k2BSogdKzo2bsVWA2o5NiiImBJV3B8L0ETuQVZpWTwfbBq+6/fxBSuPU XS1SR3meALsKmBiJBvcuVYYjJIvghqDxKfND7FiCVnoVIARUY0W3P2I1ru7NkfN6N/ BobSbHKU/BaOBIMD09My+aLx9kRs4ZMqehiscFSRE1Nxl1XFat5UNHHWYaHEKj1MfQ EMzw4jFC4eDlU92j40B0e/ALMxFHdnJpNK5xmwu34Coe+FuJBSBfwS2oQ5egEa/OlI ZNSht26et4qtA== 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 , Jesper Dangaard Brouer , 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 , Florian Westphal , Edward Cree , linux-kernel@vger.kernel.org, netdev@vger.kernel.org Reply-To: Alexander Lobakin Subject: [PATCH v4 net-next 05/11] skbuff: use __build_skb_around() in __alloc_skb() Message-ID: <20210210162732.80467-6-alobakin@pm.me> In-Reply-To: <20210210162732.80467-1-alobakin@pm.me> References: <20210210162732.80467-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.1