Article View: linux.kernel.netdev
Article #13117Re: [PATCH net v4 1/2] tun: bound the NAPI receive queue
From: Antonio Quartulli
Date: Mon, 09 Nov 2026 10:22
Date: Mon, 09 Nov 2026 10:22
42 lines
10466 bytes
10466 bytes
Hi,
On 06/11/2026 22:04, Willem de Bruijn wrote:
> This is quite a complex solution.
Yeah, I agree. Trying to address all concerns (including Sashiko's) got
me a bit out of track.
>
> Can we perhaps simplify it a bit? For instance:
>
> On tx only keep the lockless check. Number of packets that can bypass
> that is bounded, by the number of competing threads.
>
> On rx avoid the new queue, by not temporary presenting an empty queue:
>
> spin_lock(&queue->lock);
> if (skb_queue_len(queue) <= budget) {
> skb_queue_splice_tail_init(queue, &process_queue);
> } else {
> while (skb_queue_len(&process_queue) < budget &&
> (skb = __skb_dequeue(queue)))
> __skb_queue_tail(&process_queue, skb);
> }
> spin_unlock(&queue->lock);
>
Ok, I get your point.
Let me spin another simplified version.
Cheers,
pw-bot: cr
--
Antonio Quartulli
CEO and Co-Founder
Mandelbit Srl
https://www.mandelbit.com
Technical Details
Message-ID:
<b1d44592-ddf8-4103-ae3c-dd1c67641f01@mandelbit.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-359206-linux-kernel-netdev=dewy.ruReferences:
<20261103142232.1869185-1-antonio@mandelbit.com> <20261103142232.1869185-2-antonio@mandelbit.com> <willemdebruijn.kernel.20268598d87e6@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-359206-linux-kernel-netdev=dewy.ru From: antonio@mandelbit.com (Antonio Quartulli) Newsgroups: linux.kernel.netdev Subject: Re: [PATCH net v4 1/2] tun: bound the NAPI receive queue Date: Mon, 9 Nov 2026 11:22:24 +0100 Organization: Usenet Network Message-ID: <b1d44592-ddf8-4103-ae3c-dd1c67641f01@mandelbit.com> References: <20261103142232.1869185-1-antonio@mandelbit.com> <20261103142232.1869185-2-antonio@mandelbit.com> <willemdebruijn.kernel.20268598d87e6@gmail.com> MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 7bit Injection-Info: usenet.network; logging-data="327278"; mail-complaints-to="abuse@usenet.network" Cancel-Lock: sha1:aVOe4z+rPGtjYMkGcAERw25OhZ8= sha256:ULGv1eIZhODQQqvdQbX6aFiCz7aqm5E3VBqMTc924Nk= sha1:KkhKS57cyNem49s7gzK1PptuoBo= sha256:mgjolmQfy3jRcvE8pgEVqnmyG7TrkoTySLpgdXBzkPc= Content-Language: en-US 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 B293511378C; Mon, 9 Nov 2026 13:24:31 +0300 (MSK) X-Virus-Scanned: Debian amavisd-new at usenet.network X-Spam-Flag: NO X-Spam-Score: -3.051 X-Spam-Status: No, score=-3.051 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, 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=mandelbit.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 bGbEbTVMelb9; Mon, 9 Nov 2026 13:24:28 +0300 (MSK) X-Received-SPF: Pass (mailfrom) identity=mailfrom; client-ip=172.234.253.10; helo=sea.lore.kernel.org; envelope-from=netdev+bounces-359206-linux-kernel-netdev=dewy.ru@vger.kernel.org; receiver=<UNKNOWN> X-Authentication-Results: OpenDMARC; dmarc=none (p=none dis=none) header.from=mandelbit.com X-Received: from sea.lore.kernel.org (sea.lore.kernel.org [172.234.253.10]) by mail.dewy.ru (Postfix) with ESMTPS id AEA67113781; Mon, 9 Nov 2026 13:24:17 +0300 (MSK) X-Received: from smtp.subspace.kernel.org (conduit.subspace.kernel.org [100.77.114.92]) by sea.lore.kernel.org (Postfix) with ESMTP id 373FA10196B; Mon, 9 Nov 2026 10:22:48 +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=1794219768; b=c5ieSgwrnAJZdaFHgt8POAKuvYDH3gcVXk/8YfIiYDKqSoPjoTuIj0+borjzzYbBI3bJ f9Cik12H/0M9p/78vuyxdHYZkb8tnhHsUqqOKwz4gBJ6auKwT4KAn6HKW5wjpbV02U0MI wsk6ll73VsGn5eukdVy/CFITar0t4iFPlGoIeNIlk0aDZTqPCH9e/7FniXycvlH4FAwg3 s+MhuRqskOleITZBSnLxN/C1pHvGpCI95q2DDYuSw1VdAO+NR4g9S3e7OEeWegdTJV5q8 P8OEcRKA8Kro5kBt2YOm0OiMr2e2kYq3Lz6y3hZqqzYQF4yOdj9AAgMPE/UFXvd0WOg== X-ARC-Message-Signature: i=2; d=subspace.kernel.org; s=arc20261015; a=rsa-sha256; c=relaxed/relaxed; t=1794219768; h=X-Original-To:Received:DMARC-Filter:Received:DKIM-Signature: Message-ID:Date:X-Mailing-List:List-Id:List-Post:List-Help: List-Subscribe:List-Unsubscribe:List-Owner:Precedence:MIME-Version: User-Agent:Subject:To:Cc:References:Content-Language:From: Organization:In-Reply-To:Content-Type:Content-Transfer-Encoding: X-Rspamd-Queue-Id; bh=T7TAPE/7YhD5ngclGTREyMx61AzehRbnlDAFX5Ebjf4=; b=1H0RnOAUF8MtRBmOUsTq3XMjRUUE0TMlBd2sZnEL3YJqQ5xXJ7DSYBCsnDEzNvyXt7d2 hdlLe3I2qWhsCPcMVHdTTSh9ib9zkyiym0hhl0nannA1aoz7zEo8YXbb40aqBzHipl9ff 0xOcxDekLj3m5V0MK/QWXe3XpeV57hZBmFiN35kWGLLl5r1lhWQwfUoCcHqCR8uII1D1O AXEoM3ZYzZ+A1Px2zG0PfmlDhmskQ3NGqvQWQ5MYmt5HSW7qmUBXet3b7CyKwjdief7ij laskbfIcCsLmFcyYdb4eG5Er5Zs/FfshTQlBNG18JGPNgGfW7ON4Dya5KIMP55pF3lA== X-ARC-Authentication-Results: i=2; smtp.subspace.kernel.org; dkim=pass header.d=mandelbit.com header.i=@mandelbit.com header.a=rsa-sha256 header.s=MBO0001 header.b=Rnq7w67q; dmarc=none header.from=mandelbit.com; spf=pass smtp.mailfrom=mandelbit.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 0D0A5606A334; Mon, 9 Nov 2026 10:22:48 +0000 (UTC) X-Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key, unprotected) header.d=mandelbit.com header.i=@mandelbit.com header.a=rsa-sha256 header.s=MBO0001 header.b=Rnq7w67q X-Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.remote-ip=195.10.208.55 X-ARC-Seal: i=1; d=subspace.kernel.org; s=arc20261015; a=rsa-sha256; cv=none; t=1794219761; b=zj+LiqL6dbQyFYUZJIXU/Em7riGkXjWE/Rt0u25/+uHb+8XEtV+GYhG6X9bJ5g6jgWvA L4GojnHa8FSGqq5e73Xhl9YJsUSJ35Hpzj/mTjrjjeVZTi8r8E7jTjLOD+QBYpqmAp9mZ wwpAZyWKJsYr93zJnssMwYMpmYRkBRuDufHyAfyGPWwgmgM0bDD5iUxGwItGTtm8/E6UO CJw4O8r7wbMnWU6c7bkmjAjHEexWg7339ISVN1UvVb+IL2YGMlQ3NgKnbHQiblLrLSdP+ sRsOSl/JZgfBEGiWjAYrDsnm47lFR7fCA8mhy4pWXuj4YSdg83BH9CZRLALI/8AWQTg== X-ARC-Message-Signature: i=1; d=subspace.kernel.org; s=arc20261015; a=rsa-sha256; c=relaxed/relaxed; t=1794219761; h=DMARC-Filter:Received:DKIM-Signature:Message-ID:Date:MIME-Version: User-Agent:Subject:To:Cc:References:Content-Language:From: Organization:In-Reply-To:Content-Type:Content-Transfer-Encoding: X-Rspamd-Queue-Id; bh=T7TAPE/7YhD5ngclGTREyMx61AzehRbnlDAFX5Ebjf4=; b=iUDpQ1R1D3f4iau/jqPb405RhYY/vk3T0Dpsemb8pU5YcA46D4beF1MpGdWrgHlHg2ET 4FEpVjpkrJo2bvASkeCxb3rUx7MHmzJxr2MWyIl313QTdvl6Hla/OLVpJJXWS7P+zWEwe ImI53GKUM0NyGH6UANDC+/RxvbuECaBn0bbXYJiIIcUieUDH3GTO1nboQHhACbkhhRfRW wZJ19jzZTCpYVJkTWIknQ5NRVkVt/kqEEVAl012Lkje4B7hOToZMj4TAZsj4TACGkbXZz aV5cwydQxTI+SNNWZIbMNChzVoIb9oS11XYiybPSikktrYb4B8ORuCfD3WWfnccwnxw== X-ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=none header.from=mandelbit.com; spf=pass smtp.mailfrom=mandelbit.com; dkim=pass header.d=mandelbit.com header.i=@mandelbit.com header.a=rsa-sha256 header.s=MBO0001 header.b=Rnq7w67q; arc=none smtp.remote-ip=195.10.208.55 X-Received: from mout-b-110.mailbox.org (mout-b-110.mailbox.org [195.10.208.55]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature ECDSA (prime256v1) server-digest SHA256) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 8D0AC606A325; Mon, 9 Nov 2026 10:22:39 +0000 (UTC) X-DMARC-Filter: OpenDMARC Filter v1.4.2 smtp.subspace.kernel.org 8D0AC606A325 X-Authentication-Results: smtp.subspace.kernel.org; dmarc=none (p=none dis=none) header.from=mandelbit.com X-Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=mandelbit.com X-Received: from smtp1.mailbox.org (smtp1.mailbox.org [IPv6:2001:67c:2050:b231:465::1]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519MLKEM768 server-signature RSA-PSS (4096 bits) server-digest SHA256) (No client certificate requested) by mout-b-110.mailbox.org (Postfix) with ESMTPS id 4jNQnw5dx8zNlct; Mon, 09 Nov 2026 11:22:28 +0100 (CET) X-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=mandelbit.com; s=MBO0001; t=1794219748; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=T7TAPE/7YhD5ngclGTREyMx61AzehRbnlDAFX5Ebjf4=; b=Rnq7w67qr3fdW8K0dRjJ2X5SQEXHYt+9dK6WfcRgEEH9wqqXahCq4z5TfX6F9sw3GOaGwy SEJbn0MEekLBrYoRMtUPQHCOPd5TWRksWGbTtJ0+WN9kfo2Fy1VaVBWjUTS4/76B9TzWtb bQfnhf2mgTI4r1DRQjews0iTccI7u0vht8j17p52PfqfY4A/O8/QB+wNIQN4bWBsmtLyt3 SXT1TJNvmxVHpds8f6IPmWWhCoHU/sxlGmNsKbYBQn+W9/INgwj8WXYqU7EZ0RJ1zP91Jb XghtWp+xinEG90AxN+ScwFyZSmiwq3x9CjEl2gtRkLXy8mfNI6hrMxyOx4p+LQ== X-Authentication-Results: outgoing_mbo_mout; dkim=none; spf=pass (outgoing_mbo_mout: domain of antonio@mandelbit.com designates 2001:67c:2050:b231:465::1 as permitted sender) smtp.mailfrom=antonio@mandelbit.com 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-User-Agent: Mozilla Thunderbird X-Cc: andrew+netdev@lunn.ch, davem@davemloft.net, edumazet@kernel.org, kuba@kernel.org, pabeni@redhat.com, horms@kernel.org, mst@redhat.com, eperezma@redhat.com, shuah@kernel.org, ast@kernel.org, daniel@iogearbox.net, hawk@kernel.org, john.fastabend@gmail.com, sdf@fomichev.me, maheshb@google.com, peterpenkov96@gmail.com, netdev@vger.kernel.org, virtualization@lists.linux.dev, linux-kselftest@vger.kernel.org, bpf@vger.kernel.org X-Organization: Mandelbit SRL X-In-Reply-To: <willemdebruijn.kernel.20268598d87e6@gmail.com> X-Rspamd-Queue-Id: 4jNQnw5dx8zNlct