Received: by 2002:a05:6a10:8c0a:0:0:0:0 with SMTP id go10csp3695772pxb; Sat, 13 Feb 2021 06:17:37 -0800 (PST) X-Google-Smtp-Source: ABdhPJwTdy8d6c3zbFDrOkGRMg8yvilVMX0G6yjA3JkSsxpcY3VAhpBL3bQ8SbYPjUJB1rBcDiCg X-Received: by 2002:a17:906:2e90:: with SMTP id o16mr2442512eji.467.1613225857183; Sat, 13 Feb 2021 06:17:37 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1613225857; cv=none; d=google.com; s=arc-20160816; b=SEGanm3iWRViClpdz3tM8H8ehQJuAyhc2vp5zKyGJTQvrLIoEIOqgdwI9SSzkNVQQe pXc9/99gvFI+FzkVkn0DdlWaeCV179qqeRj1YNYI/F29dRrhWXoJDUZNC+7N28ReL+6m /Ng+aCWQpym+4BfNDWeEyXduYIC5FfhmNsj1HPTOnyxLizkXUFB0tEWbggzP4JrTO2qg ZZ/LrNNbovkg00fbQu+sXeWeK+cmKFvWXcCYLsOpXedPR7T3QMM2KiWPVHAI6InCgcie rNwU6IyU0hh/Qy7TBJpfBiHcVeWRNIaJcHiGjJJFjFfCEqdY6KbnIh+zFmQH+LhUgPUe pxng== 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=tHCr6RDYCSI7jSnI3ovLFYotDnAJfu9bwTuk9eWipd54eEUtj7/ITq+WSXZdh12g9X n866dJ2+sMWNuFKvIQ848f0wLB5l50WPJAwOdR7X8zJwaLyC+4uqDnutrvffLohSCKdC ehK/Me4WCqM+hqT8as7MvuGvNav3FSewajtByNPdl84WXMqlWY92I38rW8e6vIvCvKZ7 MV81UIWwCTtssXLLNVnHAxcBvIdI/XU18qY6AbrrP3JDF8K6t4fdBGNe2rhQIfXcXPXT hjKg5u8C1qiXIzyhSX3KGthA+H7y4GaHdZCxzkkLs6J/56VEt9j2aTlGNfaxYLXEUTRu xwvg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@pm.me header.s=protonmail header.b=RaAV81wO; 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 r13si8860684edd.388.2021.02.13.06.17.13; Sat, 13 Feb 2021 06:17:37 -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=RaAV81wO; 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 S229890AbhBMONR (ORCPT + 99 others); Sat, 13 Feb 2021 09:13:17 -0500 Received: from mail2.protonmail.ch ([185.70.40.22]:45003 "EHLO mail2.protonmail.ch" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229803AbhBMOMn (ORCPT ); Sat, 13 Feb 2021 09:12:43 -0500 Date: Sat, 13 Feb 2021 14:11:50 +0000 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=pm.me; s=protonmail; t=1613225518; bh=9n7R30ez+8NGaLh1O893hoIhJlElIMgk5xtfqPCBjQ8=; h=Date:To:From:Cc:Reply-To:Subject:In-Reply-To:References:From; b=RaAV81wOT41uf0Fa31OhDFMqkCf1CVw4TH+gpDIgD3MlVTgbBNfnfE6PeSbnRPG+u V+ST/ZLtmziiSrlCqKtmlR7rsqJeobYwCAZvr5Gt7Q5PWlDd/rwxlkeLjN1MbECCqH vTCUcue4t69Q0wH0v3ccGKUM6qRH57QNc1rC03sGhPIzZrwg3sd06ogsAgqIYyOOY2 es/yJsC9QSQb5hl+Vwz6ORUgXNjUtAq2oeT+Cc/ftErL5G0yA8bscAkInz9VtoUkVn HLDikLfOV9VKWJlmdEug7cPZ8zd1yv4bvQ7lkx/EKZKq8uCIL6j3jwooZMx37jDxP1 Y4j6GvtlE/lLQ== 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 , Alexander Duyck , Alexander Duyck , Alexei Starovoitov , Daniel Borkmann , Andrii Nakryiko , Taehee Yoo , Wei Wang , Cong Wang , =?utf-8?Q?Bj=C3=B6rn_T=C3=B6pel?= , Miaohe Lin , Guillaume Nault , Florian Westphal , Edward Cree , linux-kernel@vger.kernel.org, netdev@vger.kernel.org Reply-To: Alexander Lobakin Subject: [PATCH v6 net-next 05/11] skbuff: use __build_skb_around() in __alloc_skb() Message-ID: <20210213141021.87840-6-alobakin@pm.me> In-Reply-To: <20210213141021.87840-1-alobakin@pm.me> References: <20210213141021.87840-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