Received: by 2002:a05:6a10:8c0a:0:0:0:0 with SMTP id go10csp2386930pxb; Thu, 11 Feb 2021 11:00:54 -0800 (PST) X-Google-Smtp-Source: ABdhPJwCs/GjMeWzOvgvdal1y5i3AiS/kNZw/MEuxSKnJDu37o/R6nbN5Tv6oxSgV6gyxwkeZQ5Y X-Received: by 2002:a17:906:1c1b:: with SMTP id k27mr4350413ejg.402.1613070053814; Thu, 11 Feb 2021 11:00:53 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1613070053; cv=none; d=google.com; s=arc-20160816; b=FIUDRZ+PPIt06b0gCQBkskjjB9EcTCgQyBCQ6JU+dORGTbBA1JzlYC2L9X+3tSM9gh AupyPZirku4evrKjmqH5FFpXWd9Sp6TozQ8VqMA4xu4CvERd3G1h/b5ZGrWHiMsIWfV/ BpMffMyW+cew2P141YZQddOb/iPWY4qD/8SIV8jMwL86X8EBlBJkhNwjf8TnJ3hr96Nr M/7vxKj+P/sXo4iCvl6Fj0rkpIdHCvi53XnjPcIg8V1Az8v7R7CQ81H8pQlSFYV5Wfei s/LXqB4EUJMPgqcP9/SIgPRMkGOVzuwximF1BKmfqYQS2CTokqKPfx5MJ9UZALe3A5Fy ikcA== 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=xyL5in5hCFHOkX54TxV61bHKAmWBd+/TksCrn5aRKI382LNjRh3f/j6RL3/KUHWRR0 4ffDF/AgCtALBS8VbpPisZbmEOgC8KGM9xM4D+RCsAbg010YbrXfimf0HjHvTRGF6Y1n 7QpjCo7n4l2hVk0WNA3tEiMVLkNDOqjSIIpIvUarY892TArP/0Zl9QBbK/8jckfsvrBM HWs8ZcRuvuZBKXxk9TjRGsVWRo7JiBJd+9OeTAo9wb0YgSez76cYP+fruZTtSvEumvzt hBk5inPqJJuugBoyK8ypYBDirTyaB0PqvaAhxHBbOnMpNqx+hdK7xXiPtrDMZEpWwkp0 QUIA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@pm.me header.s=protonmail header.b=chP8492R; 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 z9si4485113ejm.194.2021.02.11.11.00.03; Thu, 11 Feb 2021 11:00:53 -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=chP8492R; 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 S229617AbhBKS4F (ORCPT + 99 others); Thu, 11 Feb 2021 13:56:05 -0500 Received: from mail-40134.protonmail.ch ([185.70.40.134]:46566 "EHLO mail-40134.protonmail.ch" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S230399AbhBKSyq (ORCPT ); Thu, 11 Feb 2021 13:54:46 -0500 Date: Thu, 11 Feb 2021 18:53:59 +0000 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=pm.me; s=protonmail; t=1613069642; bh=9n7R30ez+8NGaLh1O893hoIhJlElIMgk5xtfqPCBjQ8=; h=Date:To:From:Cc:Reply-To:Subject:In-Reply-To:References:From; b=chP8492ReE2oM8mpgkMRMIW4a/jiSUkEx0500H0A/aQXj3DYv93eb8kbztbXFnNoc ZHM/izUMvOmcj2XbrCKHU7x33tNvWp4DA+yEEDA/TVNV4/ELkx9WXWGfCxdnOqbAIi rI9v4qqA5k7ZR0ry5z7+KFPMo78p0BBN0PgYEI2kDG1Xu1OygZZbyll4X3E4fjX9hs pehIzuKBmEsicvQUktJHME+jdkcEKCgbnW223YxY2asr20OZIQ3kYhH13Fs0mEMl98 xMKctkM/TTytqHqoFWWdZf1uaJbvVvcyqXG0rWEjrc+eJnEBqM4E36mKjHgif4mBMY Fi2sO75az8hKg== 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 , 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 v5 net-next 05/11] skbuff: use __build_skb_around() in __alloc_skb() Message-ID: <20210211185220.9753-6-alobakin@pm.me> In-Reply-To: <20210211185220.9753-1-alobakin@pm.me> References: <20210211185220.9753-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