From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from fout-a4-smtp.messagingengine.com (fout-a4-smtp.messagingengine.com [103.168.172.147]) (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 7FF23325487 for ; Tue, 4 Nov 2025 14:43:06 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=103.168.172.147 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1762267390; cv=none; b=ZHAJZs7CY7dbMAqvgIGjVR4V3I++UskpWkAax/7Aq7k/Yak8K+Kev1ZeRhz8tO1v2SOQ9fw6Wn5ahfHxX11AZFI09Zd4kvOgIJShxgx7EleRFI9fyAErHICLJoKNPcVUAzd5zZT7Gbh3jkVpKJe5R31rctMANHmGKSTb5hEP2Fk= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1762267390; c=relaxed/simple; bh=jhguX79C9RY3QvJzWJC9tvIaqpB9tcuB3Ydkrhow7Og=; h=Date:From:To:Cc:Subject:Message-ID:References:MIME-Version: Content-Type:Content-Disposition:In-Reply-To; b=tyZTayXIuw/kPYAjFr+MJvXMOQWMEQW+N5DfCoqwShlXYLafpPoP/DL1ZeLnPtiJ7dyw4MePlheaJQFj0T0FKnzINJs6nEOPPe8s4NnTLEI9EsPyWmtsibmc/iDXzVXlA8o5DQ7J9JWP5LPcc7VaS0HS6mizTIoDsQmVxkB+nxw= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dmarc=none (p=none dis=none) header.from=queasysnail.net; spf=pass smtp.mailfrom=queasysnail.net; dkim=pass (2048-bit key) header.d=queasysnail.net header.i=@queasysnail.net header.b=DoS7/k/j; dkim=pass (2048-bit key) header.d=messagingengine.com header.i=@messagingengine.com header.b=mc+0O2JL; arc=none smtp.client-ip=103.168.172.147 Authentication-Results: smtp.subspace.kernel.org; dmarc=none (p=none dis=none) header.from=queasysnail.net Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=queasysnail.net Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=queasysnail.net header.i=@queasysnail.net header.b="DoS7/k/j"; dkim=pass (2048-bit key) header.d=messagingengine.com header.i=@messagingengine.com header.b="mc+0O2JL" Received: from phl-compute-11.internal (phl-compute-11.internal [10.202.2.51]) by mailfout.phl.internal (Postfix) with ESMTP id 92CE7EC021B; Tue, 4 Nov 2025 09:43:05 -0500 (EST) Received: from phl-mailfrontend-01 ([10.202.2.162]) by phl-compute-11.internal (MEProxy); Tue, 04 Nov 2025 09:43:05 -0500 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=queasysnail.net; h=cc:cc:content-transfer-encoding:content-type:content-type :date:date:from:from:in-reply-to:in-reply-to:message-id :mime-version:references:reply-to:subject:subject:to:to; s=fm1; t=1762267385; x=1762353785; bh=TpbeBaBfW6pAOxCvGLRslUuy+5l3AuXh hbUwHmHAmP8=; b=DoS7/k/jTFGCSH0vSqHWFX38Ck3Z+bz5wrToXHuqlqvzbgDP bXCCAZ6VDcsmVoYiK/rb4nxEpkAWdShagV8o7E1SnMuUgbUnwjH2CVqc15bolM0N YpKHXYHmUTixPQmIBZQ7yjHp7twCEX6P8+crrSrOsMhqs5w25/7noVcmvxjOJV25 NMAEm4S+8Zi9p9+JSX0zvMa3C2sPTke8cVL2XE6KHjms/bTGjFXkRd0qwwy3jaTE w3SeoDaEugsJ0ZrpxSITBFD2b8ceXOUDttVmFUenO4M+VuQC64txl6ZYfyLDuHI/ el+togRF3shgNb+kPiVWDos+KFXzchml7fsBqw== DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d= messagingengine.com; h=cc:cc:content-transfer-encoding :content-type:content-type:date:date:feedback-id:feedback-id :from:from:in-reply-to:in-reply-to:message-id:mime-version :references:reply-to:subject:subject:to:to:x-me-proxy :x-me-sender:x-me-sender:x-sasl-enc; s=fm3; t=1762267385; x= 1762353785; bh=TpbeBaBfW6pAOxCvGLRslUuy+5l3AuXhhbUwHmHAmP8=; b=m c+0O2JL9k4De3+J3oI8kSfbXoPUl6WHsZUV1KWwSe1DzgSPdbma7GUtjsiWduS0q fp7PrsLdsoOy4xREQbT0SvspKbmj834pVHnJSyFQL9C8r0ZVl4tLkHpSu3W2zMT1 8I6D72L/s+OwuizFsRxvdt9eurIm3AE7tdZZSDI0Wyk8c66FAY1nnZuoFbqAlxJS HBXJgCnuEgLMkdjExsdRh1iJd8i+Ch5Ozdr3F8CNMm3ItLg/3j3I00vSUc1OnalT u1j1rLksDuUvQ/TKxzEMq9FqtcLisM870ASlGEXtQcIaJika4GZurypKWqfbh7Ml LV7ySo3CseOt2DOoTK5fQ== X-ME-Sender: X-ME-Received: X-ME-Proxy-Cause: gggruggvucftvghtrhhoucdtuddrgeeffedrtdeggddukeduvdelucetufdoteggodetrf dotffvucfrrhhofhhilhgvmecuhfgrshhtofgrihhlpdfurfetoffkrfgpnffqhgenuceu rghilhhouhhtmecufedttdenucesvcftvggtihhpihgvnhhtshculddquddttddmnecujf gurhepfffhvfevuffkfhggtggugfgjsehtkeertddttdejnecuhfhrohhmpefurggsrhhi nhgrucffuhgsrhhotggruceoshgusehquhgvrghshihsnhgrihhlrdhnvghtqeenucggtf frrghtthgvrhhnpefgvdegieetffefvdfguddtleegiefhgeeuheetveevgeevjeduleef ffeiheelvdenucevlhhushhtvghrufhiiigvpedtnecurfgrrhgrmhepmhgrihhlfhhroh hmpehsugesqhhuvggrshihshhnrghilhdrnhgvthdpnhgspghrtghpthhtohepfedpmhho uggvpehsmhhtphhouhhtpdhrtghpthhtohepvgguuhhmrgiivghtsehgohhoghhlvgdrtg homhdprhgtphhtthhopehnhhhuughsohhnsegrkhgrmhgrihdrtghomhdprhgtphhtthho pehnvghtuggvvhesvhhgvghrrdhkvghrnhgvlhdrohhrgh X-ME-Proxy: Feedback-ID: i934648bf:Fastmail Received: by mail.messagingengine.com (Postfix) with ESMTPA; Tue, 4 Nov 2025 09:43:04 -0500 (EST) Date: Tue, 4 Nov 2025 15:43:02 +0100 From: Sabrina Dubroca To: Eric Dumazet Cc: "Hudson, Nick" , "netdev@vger.kernel.org" Subject: Re: skb_attempt_defer_free and reference counting Message-ID: References: Precedence: bulk X-Mailing-List: netdev@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Disposition: inline Content-Transfer-Encoding: 8bit In-Reply-To: 2025-10-31, 04:43:19 -0700, Eric Dumazet wrote: > On Fri, Oct 31, 2025 at 4:04 AM Hudson, Nick wrote: > > > > Hi, > > > > I’ve been looking at using skb_attempt_defer_free and had a question about the skb reference counting. > > > > The existing reference release for any skb handed to skb_attempt_defer_free is done in skb_defer_free_flush (via napi_consume_skb). However, it seems to me that calling skb_attempt_defer_free on the same skb to drop the multiple references is problematic as, if the defer_list isn’t serviced between the calls, the list gets corrupted. That is, the skb can’t appear on the list twice. > > > > Would it be possible to move the reference count drop into skb_attempt_defer_free and only add the skb to the list on last reference drop? > > We do not plan using this helper for arbitrary skbs, but ones fully > owned by TCP and UDP receive paths. > > skb_share_check() must have been called before reaching them. Do you think it's worth adding another DEBUG_NET_WARN_ON_ONCE check to skb_attempt_defer_free(), to validate (and in a way, document) that assumption? -- Sabrina