🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

Article View: linux.kernel.netdev
Article #2449

Re: [PATCH net] net: skbuff: don't copy alloc_cpu in skb header copies

#2449
From: Björn Töpel
Date: Mon, 12 Oct 2026 15:26
53 lines
7529 bytes
Carolina Jubran <cjubran@nvidia.com> writes:

> Commit 68822bdf76f1 ("net: generalize skb freeing deferral to
> per-cpu lists") added alloc_cpu to struct sk_buff and placed it in the
> headers group copied by __copy_skb_header().
>
> This is wrong for newly allocated skbs. For example, skb_segment()
> allocates a new skb and records the current CPU in alloc_cpu, but
> __copy_skb_header() overwrites it with the value from the original skb.
>
> If the original skb was allocated on another CPU, the segment may later
> be treated as remotely allocated and unnecessarily deferred there when
> it is freed.
>
> Move alloc_cpu out of the headers group so it is preserved across
> header copies. Initialize it explicitly in skb_clone(), which allocates
> the skb object directly instead of going through __alloc_skb().
>
> This was discovered while investigating a throughput regression with
> software IPsec. The load used 512 IPsec tunnels carrying traffic over
> VXLAN, with 512 parallel iperf3 flows and an MTU of 4500.
>
> Before the fix:
>
>   16.09%  queued_spin_lock_slowpath
>              |
>              --15.90%--_raw_spin_lock_irqsave
>                        |
>                        --9.37%--__slab_free
>                                  kfree
>                                  skb_release_data
>                                  napi_consume_skb
>                                  mlx5e_poll_tx_cq
>
> After the fix:
>
>    6.84%  queued_spin_lock_slowpath
>              |
>              --6.57%--_raw_spin_lock_irqsave
>                       |
>                       --5.00%--__slab_free
>                                 kfree
>                                 skb_release_data
>                                 napi_consume_skb
>                                 mlx5e_poll_tx_cq
>
> Fixes: 68822bdf76f1 ("net: generalize skb freeing deferral to per-cpu lists")
> Signed-off-by: Carolina Jubran <cjubran@nvidia.com>
> Reviewed-by: Dragos Tatulea <dtatulea@nvidia.com>

Reviewed-by: Björn Töpel <bjorn@kernel.org>
Technical Details
Message-ID: <87mrsjaqj4.fsf@all.your.base.are.belong.to.us>
Path: mbox-mo1.pugleaf.net!archive.usenet.blueworldhosting.com!usenet.blueworldhosting.com!diablo1.usenet.blueworldhosting.com!usenet.network!.POSTED!vger.kernel.org!netdev+bounces-345065-linux-kernel-netdev=dewy.ru
References: <20261012124544.2018007-1-cjubran@nvidia.com>

Show Full Headers
Complete Article Headers
Path: mbox-mo1.pugleaf.net!archive.usenet.blueworldhosting.com!usenet.blueworldhosting.com!diablo1.usenet.blueworldhosting.com!usenet.network!.POSTED!vger.kernel.org!netdev+bounces-345065-linux-kernel-netdev=dewy.ru
From: bjorn@kernel.org (Björn Töpel)
Newsgroups: linux.kernel.netdev
Subject: Re: [PATCH net] net: skbuff: don't copy alloc_cpu in skb header copies
Date: Mon, 12 Oct 2026 17:26:39 +0200
Organization: Usenet Network
Message-ID: <87mrsjaqj4.fsf@all.your.base.are.belong.to.us>
References: <20261012124544.2018007-1-cjubran@nvidia.com>
MIME-Version: 1.0
Content-Type: text/plain; charset=utf-8
Content-Transfer-Encoding: quoted-printable
Injection-Info: usenet.network;
	logging-data="1836523"; mail-complaints-to="abuse@usenet.network"
Cancel-Lock: sha1:sc3aeokoDu7IoCLKacQGGuMLLn4= sha256:RNvu9uvTex7Srvn5ab6AW5s61Ma6cZk/au1f/1oN2Rw=
	sha1:b7n4NEojmhlCIQUpJDczqrAH5qI= sha256:QmdJ/Frb2lSluGel7skHyM+2tEI0A0Z8U0mwKwvZM8E=
List-ID: <netdev.vger.kernel.org>
X-Mailpost-Empty-Hdrs: X-Spam-Level
X-Received: from localhost (localhost [127.0.0.1])
	by mail.dewy.ru (Postfix) with ESMTP id AF99610FC7C; Mon, 12 Oct 2026 20:20:15 +0300 (MSK)
X-Virus-Scanned: Debian amavisd-new at usenet.network
X-Spam-Flag: NO
X-Spam-Score: -1.341
X-Spam-Status: No, score=-1.341 tagged_above=-9999 required=6.31
	tests=[DCC_REPUT_70_89=0.1, DKIMWL_WL_HIGH=-0.241, DKIM_SIGNED=0.1,
	DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1,
	MAILING_LIST_MULTI=-1, SPF_HELO_NONE=0.001, SPF_PASS=-0.001]
	autolearn=ham autolearn_force=no
X-Authentication-Results: mail.dewy.ru (amavisd-new); dkim=pass (2048-bit key)
	header.d=kernel.org
X-Received: from mail.dewy.ru ([127.0.0.1])
	by localhost (mail.dewy.ru [127.0.0.1]) (amavisd-new, port 10024)
	with ESMTP id oo7gj2WTJ4ZG;
	Mon, 12 Oct 2026 20:20:13 +0300 (MSK)
X-Received-SPF: Pass (mailfrom) identity=mailfrom; client-ip=172.234.253.10; helo=sea.lore.kernel.org; envelope-from=netdev+bounces-345065-linux-kernel-netdev=dewy.ru@vger.kernel.org; receiver=<UNKNOWN> 
X-Authentication-Results: OpenDMARC; dmarc=pass (p=quarantine dis=none) header.from=kernel.org
X-Received: from sea.lore.kernel.org (sea.lore.kernel.org [172.234.253.10])
	by mail.dewy.ru (Postfix) with ESMTPS id 87E8C10FC72; Mon, 12 Oct 2026 20:20:04 +0300 (MSK)
X-Received: from smtp.subspace.kernel.org (conduit.subspace.kernel.org [100.90.174.1])
	by sea.lore.kernel.org (Postfix) with ESMTP id 9BB5AC7FD0; Mon, 12 Oct 2026 15:27:54 +0000 (UTC)
X-Received: from localhost.localdomain (localhost.localdomain [127.0.0.1])
	by smtp.subspace.kernel.org (Postfix) with ESMTP id 49F014A2066;
	Mon, 12 Oct 2026 15:26:44 +0000 (UTC)
X-Authentication-Results: smtp.subspace.kernel.org;
	dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b="NDcrsVcQ"
X-Received: from smtp.kernel.org (aws-us-west-2-korg-mail-alma10-1.taild15c8.ts.net [100.103.45.18])
	(using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits))
	(No client certificate requested)
	by smtp.subspace.kernel.org (Postfix) with ESMTPS id 2B89649D5B8;
	Mon, 12 Oct 2026 15:26:42 +0000 (UTC)
X-Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=100.103.45.18
X-ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116;
	t=1791818804; cv=none; b=WH1W5BHWVhBIz9xLFNGyp6NEs8pZG+ULr1fM/z+bx/Ht0/9nCeIw5yaj3EeZyDcH1x1TQHkpIRiqQooHYP47yNiyz1sFlztder9YdxBCmnUpxVmRAUDlc9Tozkp7rULv3NgY02lkq7u95kgIwMti0Ln7ta0j4CLtRaTLJkBq2dw=
X-ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org;
	s=arc-20240116; t=1791818804; c=relaxed/simple;
	bh=jba6O2iJvdsyyhGegzm9juTaIFjCBHqZsWi/0/nuRng=;
	h=From:To:Cc:Subject:In-Reply-To:References:Date:Message-ID:
	 MIME-Version:Content-Type; b=maQA0RAyicfjPYmjjjTiqnEhMwtOTIda5J9CGr699fgBaZiOoePtRfOP2BDkuMwxOZl9gBLT0ro5IJnSAC5Yz9wHizqzVji2S3VJ2KAZzV4srZM33m+J971iEVhcXe3SdFkvWehwXrCiZIXgVz3Qj4/f8bLRBcKgqAh6n5A9fpA=
X-ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b=NDcrsVcQ; arc=none smtp.client-ip=100.103.45.18
X-Received: by smtp.kernel.org (Postfix) with ESMTPSA id 1B39B1F0089C;
	Mon, 12 Oct 2026 15:26:41 +0000 (UTC)
X-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=kernel.org;
	s=k20260515; t=1791818802;
	bh=E80nuRDCCDHbPtCHARlcSoYUnV2HMctcMo5RHmYnRrU=;
	h=From:To:Cc:Subject:In-Reply-To:References:Date;
	b=NDcrsVcQ+sc2NbjZxysVV3F/MXvby1sjueGFZMIxAPUdtzy3n2DySPbww61kPN+ht
	 ysOrrK/FR6gkgpSQ7Z5qI912IjJ/6nneHX4J8CKi8BVpuzr7LXub2jVQUZeTFTSHmV
	 mGKnS472gdwVgHEYw6UQ/sQmPG9GvtfiXb5zglzGcYT6yoRoeGgljOoFUUayKPEZ/5
	 WJcICc3LVXV4Ck4oTgQSjGAMzAxOYa/PydZNcUjLoMjizQL7MQmtdmJeeR2YSMknjF
	 9gjXCTk8kjY6xmtpMFFURlnZ1+L/TypfgoOVhSvj8EyDNG6Z/l9XNP41zDg9nYQ+BY
	 wYl4e7D7eNGVw==
X-Cc: Simon Horman <horms@kernel.org>, Jason Xing <kerneljasonxing@gmail.com>,
 Kuniyuki Iwashima <kuniyu@google.com>, Jiayuan Chen
 <jiayuan.chen@linux.dev>, netdev@vger.kernel.org,
 linux-kernel@vger.kernel.org, Carolina Jubran <cjubran@nvidia.com>, Dragos
 Tatulea <dtatulea@nvidia.com>
X-In-Reply-To: <20261012124544.2018007-1-cjubran@nvidia.com>
X-Precedence: bulk
X-Mailing-List: netdev@vger.kernel.org
X-List-Subscribe: <mailto:netdev+subscribe@vger.kernel.org>
X-List-Unsubscribe: <mailto:netdev+unsubscribe@vger.kernel.org>