🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

Article View: linux.kernel.netdev
Article #9991

Re: [PATCH net-next 2/7] net: devmem: charge the frag length to TX skb truesize

#9991
From: Stanislav Fomichev
Date: Mon, 02 Nov 2026 23:23
39 lines
13158 bytes
On 11/02, Mina Almasry wrote:
> On Mon, Nov 2, 2026 at 11:14 AM Stanislav Fomichev <sdf.kernel@gmail.com> wrote:
> >
> > truesize isn't well defined for devmem TX frags: they point into a
> > dmabuf which stays mapped for the lifetime of the binding, and freeing
> > the skb releases no memory. The charge only feeds sk_sndbuf and TSQ,
> > which limit queued bytes.
> >
> > Charge the frag length instead of PAGE_SIZE:
> > - TCP uncharges in bytes (tcp_trim_head(), tcp_fragment(),
> >   tso_fragment()), so the charge must not be smaller than the frag.
> >   PAGE_SIZE only guarantees that while net_iovs are PAGE_SIZE.
> > - Frags shorter than a page now count their length, not a page.
> >
> 
> I don't know about this patch. The justification reads a bit like.
> "net-iov charging is weird and broken anyway, so we can do whatever we
> want. Charge size instead of PAGE_SIZE for no reason."
> 
> I agree that charging for net-iov is extremely weird. Neither of
> today's net-iov types actually allocates any memory. Of course when I
> was developing the original infra, I took every shortcut I could and
> just charged net-iov as regular memory, but that doesn't mean we can
> do whatever we want.
> 
> I think either:
> 
> 1. say net-iovs are not really occupied memory, so do a global cleanup
> that charges 0 for all net-iovs (optionally making it conditional on
> the net-iov type, so in the future someone can easily add a net-iov
> that actually can be charged)", or
> 2. change the net-iov size to be actually size instead of PAGE_SIZE,
> and keep the current 'we charge net-iovs even though they're not
> really memory', and then this patch makes sense.

SG, let me try to explain it better in the commit msg. I don't think
we can charge 0 because the uncharge path is non-zero. It currently
works ok because skb frag uncharges the small error that can accumulate.
Technical Details
Message-ID: <aukaiHZJcYsRCpr0@devvm16445.scu0.facebook.com>
Path: mbox-mo1.pugleaf.net!archive.usenet.blueworldhosting.com!usenet.blueworldhosting.com!diablo1.usenet.blueworldhosting.com!usenet.network!.POSTED!vger.kernel.org!netdev+bounces-355112-linux-kernel-netdev=dewy.ru
References: <20261102191438.1059771-1-sdf@fomichev.me> <20261102191438.1059771-3-sdf@fomichev.me> <CAHS8izPefhGytGNeDWZzgZOi=gLeigZ63nFnkq1ERXXGwrNkeg@mail.gmail.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-355112-linux-kernel-netdev=dewy.ru
From: sdf.kernel@gmail.com (Stanislav Fomichev)
Newsgroups: linux.kernel.netdev
Subject: Re: [PATCH net-next 2/7] net: devmem: charge the frag length to TX
 skb truesize
Date: Mon, 2 Nov 2026 15:23:26 -0800
Organization: Usenet Network
Message-ID: <aukaiHZJcYsRCpr0@devvm16445.scu0.facebook.com>
References: <20261102191438.1059771-1-sdf@fomichev.me>
 <20261102191438.1059771-3-sdf@fomichev.me>
 <CAHS8izPefhGytGNeDWZzgZOi=gLeigZ63nFnkq1ERXXGwrNkeg@mail.gmail.com>
MIME-Version: 1.0
Content-Type: text/plain; charset=utf-8
Content-Transfer-Encoding: 8bit
Injection-Info: usenet.network;
	logging-data="3056930"; mail-complaints-to="abuse@usenet.network"
Cancel-Lock: sha1:Jv47uzCE2lC1NPBmQ650BgYujqE= sha256:1atqkQgeZln9axg1UxhGsuF5UVr23/m+yGfKIx612Ag=
	sha1:3hhhiQdyv5rH6+j78ImZXRiYGk4= sha256:i8l6sNA7StJhgGjI5Aw0LzWRonA5sCRQuZlXwDQLz9Q=
Content-Disposition: inline
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 B7CFE1126DB; Tue,  3 Nov 2026 02:39:04 +0300 (MSK)
X-Virus-Scanned: Debian amavisd-new at usenet.network
X-Spam-Flag: NO
X-Spam-Score: -3.049
X-Spam-Status: No, score=-3.049 tagged_above=-9999 required=6.31
	tests=[DCC_REPUT_70_89=0.1, DKIM_SIGNED=0.1, DKIM_VALID=-0.1,
	DKIM_VALID_AU=-0.1, FREEMAIL_FORGED_FROMDOMAIN=0.001,
	FREEMAIL_FROM=0.001, HEADER_FROM_DIFFERENT_DOMAINS=0.249,
	MAILING_LIST_MULTI=-1, RCVD_IN_DNSWL_MED=-2.3, 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=gmail.com
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 ntEOcMndeyTn;
	Tue,  3 Nov 2026 02:39:02 +0300 (MSK)
X-Received-SPF: Pass (mailfrom) identity=mailfrom; client-ip=104.64.211.4; helo=sin.lore.kernel.org; envelope-from=netdev+bounces-355112-linux-kernel-netdev=dewy.ru@vger.kernel.org; receiver=<UNKNOWN> 
X-Authentication-Results: OpenDMARC; dmarc=fail (p=none dis=none) header.from=gmail.com
X-Received: from sin.lore.kernel.org (sin.lore.kernel.org [104.64.211.4])
	by mail.dewy.ru (Postfix) with ESMTPS id C1FC81126C5; Tue,  3 Nov 2026 02:38:51 +0300 (MSK)
X-Received: from smtp.subspace.kernel.org (conduit.subspace.kernel.org [100.77.114.92])
	by sin.lore.kernel.org (Postfix) with ESMTP id 8F5B128FD0; Mon,  2 Nov 2026 23:38:17 +0000 (UTC)
X-Authentication-Results: smtp.subspace.kernel.org; arc=pass header.oldest-pass=0 smtp.remote-ip=127.0.0.1
X-ARC-Seal: i=2; d=subspace.kernel.org; s=arc20261015; a=rsa-sha256; cv=pass;
	t=1793662691;
	b=Zn/ju5SJ5fjq5WSEEJF63FZIno8UHOMGUzDjDo9muiQ4+Sr5VyDTJE7wdCBTNiDm+w9o
	 8GBtwX5r3sq0Cgp3m+aVbZ7CYRwaLJ1b0iDS0WvnKVPyUcF4zFUZ7sNXxNdSRLf5o72Cd
	 gNbLN94j7WETHD6/g8PnJkVCHQnoe+hplPutxKltHQWgNWiD9LfKIYOU1/2XHEEaYqy/5
	 5/2AzNSbs3uassCQPYDtONOg8lllyISgPRCE0yrW0jdHpQLGbd8v7qawFt1Dzxmyezdy8
	 oJy1THAgz0LcGLQYLgBzwv6PhtfmD9RAvPbHMRJ02W9kDuV7dJJW6uMvpMrqFYeC/Kg==
X-ARC-Message-Signature: i=2; d=subspace.kernel.org; s=arc20261015;
	a=rsa-sha256; c=relaxed/relaxed; t=1793662691;
	h=X-Original-To:Received:DMARC-Filter:Received:DKIM-Signature:
	 X-Google-DKIM-Signature:X-Gm-Message-State:X-Gm-Gg:X-Received:
	 Received:Date:From:To:Cc:Subject:Message-ID:References:X-Mailing-List:
	 List-Id:List-Post:List-Help:List-Subscribe:List-Unsubscribe:
	 List-Owner:Precedence:MIME-Version:Content-Type:Content-Disposition:
	 Content-Transfer-Encoding:In-Reply-To;
	bh=ajTKbCVfUpvl1PRge5ZE4DWrvmI1TQg3QGvcmd035B4=;
	b=zEEVIOVRCUY3yz5zCxcCl3DvE+rI2vkkF/u8fbfjvE77ZD+iT5n3GMa7Se4xel0kv9Ip
	 3kDSY/sylwoauiCk5/56ZiZEvUlET6iYpVo6WUzWcdBy8YvF1sWyCgJh/cFm8UOyknVbp
	 rv4pk/YdraVHSs3ZjdZRYb41U8TiHaCiCSxmxAnUTN0sG+/685kij95WjyUcsMtbUPfXv
	 tDl8cYW5nziI6gd0wZqVEBxEgrOHf7POU32noX+9MCCxKTpmjDKeatucz4IaFV4sf/uxA
	 5NqoShcaR2CGbDzlOOk/xevZHmoIc3rUTTO5Q6v9ZFaouTGwC3JB2Gyunsyb5Pf1pPg==
X-ARC-Authentication-Results: i=2; smtp.subspace.kernel.org; 
	dkim=pass header.d=gmail.com header.i=@gmail.com header.a=rsa-sha256 header.s=20260707 header.b=eZcRAdFi;
	dmarc=pass header.from=gmail.com;
	spf=pass smtp.mailfrom=gmail.com;
	arc=pass header.oldest-pass=0 smtp.remote-ip=127.0.0.1
X-Received: from localhost.localdomain (localhost [127.0.0.1])
	by smtp.subspace.kernel.org (Postfix) with ESMTP id 7B624606D81F;
	Mon,  2 Nov 2026 23:38:11 +0000 (UTC)
X-Authentication-Results: smtp.subspace.kernel.org;
	dkim=pass (2048-bit key, unprotected) header.d=gmail.com header.i=@gmail.com header.a=rsa-sha256 header.s=20260707 header.b=eZcRAdFi
X-Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.remote-ip=74.125.229.131
X-ARC-Seal: i=1; d=subspace.kernel.org; s=arc20261015; a=rsa-sha256; cv=none;
	t=1793662685;
	b=5XP2fyWvt/CGZ2g45pU1SkKBfP4UgmR7czV0EMWab/9hn16puVGdQ9zoVi3L7qKCui2Y
	 G8A88LZMnXyqB1z3sImO1YLWecJ8IKALPfjB1dsynpoYp2Ct519GzdIoWADYLzo1q8w6F
	 4/EpVaEEer9wyIMsvkMimwZjLngnpejyyjF821jer0lM59kerc6zFR8qrZqRXEn8BJm/o
	 kiz2koh+1xscWE8wgJLbOK+NFJoJiDbx+vA+AYQsrbR4pI/i/idpzQPzbL9B81fXmNx7B
	 Fbf42Jo9/6IgkMDvWJ1QzICbp41sO53H24WwVlTi2xYnVYf53jcqybuIUDjvrPhHxzQ==
X-ARC-Message-Signature: i=1; d=subspace.kernel.org; s=arc20261015;
	a=rsa-sha256; c=relaxed/relaxed; t=1793662685;
	h=DMARC-Filter:Received:DKIM-Signature:X-Google-DKIM-Signature:
	 X-Gm-Message-State:X-Gm-Gg:X-Received:Received:Date:From:To:Cc:
	 Subject:Message-ID:References:MIME-Version:Content-Type:
	 Content-Disposition:Content-Transfer-Encoding:In-Reply-To;
	bh=ajTKbCVfUpvl1PRge5ZE4DWrvmI1TQg3QGvcmd035B4=;
	b=RuCpHImfaYsqwdgM9m+kppaozS2TDQcbCy3BkB8imvVHeBBqG1oxvO1x+OV2dJDK9fVH
	 P5a8NnR35/UIZethvyO0CD9y+iRgeUTnJ24DKIlVtH6m6UCIeD065Rq3oFIUJi95xlmY0
	 VXaQZikgGK9z65YSFU9IPuTgoqMXnpaK2cE1BLR1erLuR0dsR0BvIR6UjGzy8HLK8/5a4
	 BMQTSk4glSf5vVcaGyoIp/WW/Y5NFFB44qV8zBHGNqaCZsLLEfFBHYUQcs7ocybN8w1RQ
	 4SqL1+9NTtSRfGR03iyYaiggwH51Jmz/BqeCM1v+UkTCNLXsiYqQpbYwp+50c0Aa9jg==
X-ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; 
	dmarc=pass header.from=gmail.com;
	spf=pass smtp.mailfrom=gmail.com;
	dkim=pass header.d=gmail.com header.i=@gmail.com header.a=rsa-sha256 header.s=20260707 header.b=eZcRAdFi;
	arc=none smtp.remote-ip=74.125.229.131
X-Received: from mail-dl2-f3.google.com (mail-dl2-f3.google.com [74.125.229.131])
	(using TLSv1.3 with cipher TLS_AES_128_GCM_SHA256 (128/128 bits)
	 key-exchange X25519 server-signature ECDSA (prime256v1) server-digest SHA256)
	(No client certificate requested)
	by smtp.subspace.kernel.org (Postfix) with ESMTPS id 32453606A327
	for <netdev@vger.kernel.org>; Mon,  2 Nov 2026 23:38:05 +0000 (UTC)
X-DMARC-Filter: OpenDMARC Filter v1.4.2 smtp.subspace.kernel.org 32453606A327
X-Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=gmail.com
X-Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=gmail.com
X-Received: by mail-dl2-f3.google.com with SMTP id a92af1059eb24-1afb6473195so704783c88.0
        for <netdev@vger.kernel.org>; Mon, 02 Nov 2026 15:38:05 -0800 (PST)
X-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed;
        d=gmail.com; s=20260707; t=1793662684; x=1794267484; darn=vger.kernel.org;
        h=in-reply-to:content-transfer-encoding:content-disposition
         :content-type:mime-version:references:message-id:subject:cc:to:from
         :date:from:to:cc:subject:date:message-id:reply-to:content-type;
        bh=ajTKbCVfUpvl1PRge5ZE4DWrvmI1TQg3QGvcmd035B4=;
        b=eZcRAdFir/tOfKhPPQaXb6mUvOPizNEbwDyFtkl3vKeIKU9Co8R0LPR3N7E8YyU+0G
         2EdC+Hi7HYUfRQP/PCKsIm9h8tS8eEbpeWjCtKW5O49DuznCRmny/sHaglVMRcQjk1XW
         wZt8hlBXazvlT3+G+BQ3Bmz9IyCxfZiYOF/RVxubvZmHO0sNkpaX5eNVfAoQpCQUlI5l
         2QeIfN1za7Fyo1Y5LFedwCSm+BskmtaBZmZEv/AWmFxszO3hxsuhm+PC8SWdRra5+cJc
         WZBdVfPBmr8WSta2fMLe085t0LYYVIzsbbeoSfFqPtbxZ27fS5V/opLjzid1gkFKzQ8Y
         foCQ==
X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed;
        d=1e100.net; s=20260707; t=1793662684; x=1794267484;
        h=in-reply-to:content-transfer-encoding:content-disposition
         :content-type:mime-version:references:message-id:subject:cc:to:from
         :date:x-gm-gg:x-gm-message-state:from:to:cc:subject:date:message-id
         :reply-to:content-type;
        bh=ajTKbCVfUpvl1PRge5ZE4DWrvmI1TQg3QGvcmd035B4=;
        b=SfiJtVJ5F9NMGe+nLh/0RnQpikoFOMxqkQyq/j5O5eb6I/LLTPuEW7k7WAqNNk1dsr
         IGoB86jk6/hNwJb9lUmGBjlP5poiEc4DKS3M2HpnuPXnnH0psCN5L3CMOE+w6inYbi2g
         BgRR/AJqIQbqp7398ZU2+mquy/93kgOlUBQ4iVIeJ0kdDRhKPjFnu++ddLyvu74RhqSx
         Z2FqWuqFSGK0e7ahj88VZaxh0ynZ+ogqzdEm9ceU3FZ1xd7sT2gL4sUXkUvXRH6h8srO
         4p3WizsWNG/ypPIu1w3kPg/gmuwHOMhtB+FL3NtQaYU56hVZaXNne6nWGMCMyZNG9H0Z
         zXGA==
X-Gm-Message-State: AFq9FYKizNvGGplRDpOGt3jGXLIvHOJ89ywGOdhvAA5bJTrmjhdy9UDl
	lNWrUpWeJHRlZFknuHuNpWMAhD/cHsx4bJbCzJVFlu+gmXf/DY5F04ap
X-Gm-Gg: AYBFou36ZboVhUDuJ9ZjDSiGMkfK8vskFPAxSN7JN3cR5KfhW7K1Be0A9NDmllEwNXP
	zJEL/0vRf5d6zynfzRAiNhFKfsHSNtUDCgjEb2708qJXieNXHyu6i/1zseJ10BmL8Kdksuyizhm
	YgV/YnpZgPZHolZRutmHPLdk33g8Mv+jnS2AsQ656NauR+twUgKYFfvgZh7i53AwzL48BVeVDN3
	ZLMF/Shd+22AxvKsb1Cxcs3UEF/Ba12bAUw8Iq88apzCxb6dcX9/F7fuRMqKyyeWokNsfW1TYwb
	dxhJqcUZATovtGKDZBebgye79XfgkrKRsp2EU0t5IFIYojLx9loVBmVM9Ta1Ea4ssDaQbPN56ZW
	ZzP+aAp9LxZ2uGU1t4eGi5laTLohSccLHVNXmGlZLW3/X91HqwFH3ys76IIMPHHKvMmpW74JTOF
	4pDN5c+FIKyy590JgqmLKq1X5rurdmvlveyFdoQqHGvmRN4+2kg+oO+wdXUtRnMuGjzyd19MNkq
	kGY3+Nu5PKrfIfU7Uc/uVqiQSd4/pyAJA1W3KVQdtz4IU7ogLQKdtVUAfFIe9F+IkbT08lJ5llQ
	TkO17ETeA6NnN6SH9oSxrw==
X-Received: by 2002:a05:7022:68a4:b0:147:8a40:cdf3 with SMTP id a92af1059eb24-1ac5d1d155amr22814754c88.24.1793662684121;
        Mon, 02 Nov 2026 15:38:04 -0800 (PST)
X-Received: from localhost ([2a03:2880:9ff:60::])
        by smtp.gmail.com with ESMTPSA id a92af1059eb24-1ac1a136537sm36897502c88.18.2026.11.02.15.38.03
        (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256);
        Mon, 02 Nov 2026 15:38:03 -0800 (PST)
X-Cc: netdev@vger.kernel.org, davem@davemloft.net, edumazet@google.com, 
	kuba@kernel.org, pabeni@redhat.com, andrew+netdev@lunn.ch, edumazet@kernel.org, 
	horms@kernel.org, corbet@lwn.net, skhan@linuxfoundation.org, rdunlap@infradead.org, 
	michael.chan@broadcom.com, pavan.chebbi@broadcom.com, sdf@fomichev.me, 
	bobbyeshleman@meta.com, asml.silence@gmail.com, daniel@iogearbox.net, 
	razor@blackwall.org, leitao@debian.org, linux-doc@vger.kernel.org, 
	linux-kernel@vger.kernel.org, linux-kselftest@vger.kernel.org
X-Mailing-List: netdev@vger.kernel.org
X-List-Post: <mailto:netdev@vger.kernel.org>
X-List-Help: <mailto:netdev+help@vger.kernel.org>
X-List-Subscribe: <mailto:netdev+subscribe@vger.kernel.org>
X-List-Unsubscribe: <mailto:netdev+unsubscribe@vger.kernel.org>
X-List-Owner: <mailto:netdev+owner@vger.kernel.org>
X-Precedence: list
X-In-Reply-To: <CAHS8izPefhGytGNeDWZzgZOi=gLeigZ63nFnkq1ERXXGwrNkeg@mail.gmail.com>