Article View: linux.kernel.netdev
Article #6848Re: [PATCH net 5/5] net: restrict message_cost and message_burst to non-negative values
From: Jiayuan Chen
Date: Fri, 23 Oct 2026 14:30
Date: Fri, 23 Oct 2026 14:30
65 lines
11102 bytes
11102 bytes
On 10/23/26 8:55 PM, Fernando Fernandez Mancera wrote:
[...]
>>> #ifdef CONFIG_BPF_JIT
>>> static int proc_dointvec_minmax_bpf_enable(const struct ctl_table
>>> *table, int write,
>>> void *buffer, size_t *lenp,
>>> @@ -544,14 +560,15 @@ static struct ctl_table net_core_table[] = {
>>> .data = &net_ratelimit_state.interval,
>>> .maxlen = sizeof(int),
>>> .mode = 0644,
>>> - .proc_handler = proc_dointvec_jiffies,
>>> + .proc_handler = proc_do_message_cost,
>>> },
>>> {
>>> .procname = "message_burst",
>>> .data = &net_ratelimit_state.burst,
>>> .maxlen = sizeof(int),
>>> .mode = 0644,
>>> - .proc_handler = proc_dointvec,
>>> + .proc_handler = proc_dointvec_minmax,
>>> + .extra1 = SYSCTL_ZERO,
>>> },
>>> #ifdef CONFIG_RPS
>>> {
>>> --
>>> 2.43.0
>>>
>>
>> I would prefer something like this [1] (not tested and not compiled).
>> This is more in line with the patterns inside the jiffies.c file. I put
>> SYSCTL_ZERO there, but I have a doubt if you actually need SYSCTL_ONE.
>>
Thanks Joel and Fernando, good to hear this.
I actually had almost the same proc_dointvec_jiffies_minmax() locally at
first,
but then thought "this touches sysctl core, better not" and went with
the local handler
instead.
Glad I was wrong about that :)
>> If the interval variable can be zero, then leave it as SYSCTL_ZERO, but
>> if it cant be zero and can be one the use SYSCTL_ONE
>>
>
> FWIW, I also like this solution and indeed we can convert other users
> in the future.
>
> About SYSCTL_ZERO, I believe it is the right choice. AFAIU, it just
> disables limiting.
>
Agreed on SYSCTL_ZERO. interval == 0 is the documented "never limit"
case in ___ratelimit(), so it has to stay allowed.
> Thanks,
> Fernando.
>
Technical Details
Message-ID:
<50b46cec-9f95-42dd-8e97-5555897df4c3@linux.dev>Path:
mbox-mo1.pugleaf.net!archive.usenet.blueworldhosting.com!usenet.blueworldhosting.com!diablo1.usenet.blueworldhosting.com!news.neodome.net!usenet.network!.POSTED!vger.kernel.org!netdev+bounces-351111-linux-kernel-netdev=dewy.ruReferences:
<20261023091419.167088-1-jiayuan.chen@linux.dev> <20261023091419.167088-6-jiayuan.chen@linux.dev> <attQGnJGhzTPFsMd@hobbes> <27876dee-435f-4ea7-afed-69f8366e1c62@suse.de>Show Full Headers
Complete Article Headers
Path: mbox-mo1.pugleaf.net!archive.usenet.blueworldhosting.com!usenet.blueworldhosting.com!diablo1.usenet.blueworldhosting.com!news.neodome.net!usenet.network!.POSTED!vger.kernel.org!netdev+bounces-351111-linux-kernel-netdev=dewy.ru From: jiayuan.chen@linux.dev (Jiayuan Chen) Newsgroups: linux.kernel.netdev Subject: Re: [PATCH net 5/5] net: restrict message_cost and message_burst to non-negative values Date: Fri, 23 Oct 2026 22:30:03 +0800 Organization: Usenet Network Message-ID: <50b46cec-9f95-42dd-8e97-5555897df4c3@linux.dev> References: <20261023091419.167088-1-jiayuan.chen@linux.dev> <20261023091419.167088-6-jiayuan.chen@linux.dev> <attQGnJGhzTPFsMd@hobbes> <27876dee-435f-4ea7-afed-69f8366e1c62@suse.de> MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 8bit Injection-Info: usenet.network; logging-data="523109"; mail-complaints-to="abuse@usenet.network" Cancel-Lock: sha1:TLJozglKCZBE0G1EZqz+R4RiTQQ= sha256:DrwM4elmZFFKrrtRynSIEi9qDrLd9pyDYJWhjhlSi1Q= sha1:NaiukYHC8PGrDUHF/U9ibADHB2g= sha256:EVPeJ0zv4eVDx0BNQNjfAlJuKJFZETHVCqFTDsCE0B8= 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 9E3371114C2; Fri, 23 Oct 2026 17:33:59 +0300 (MSK) X-Virus-Scanned: Debian amavisd-new at usenet.network X-Spam-Flag: NO X-Spam-Score: -2.051 X-Spam-Status: No, score=-2.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.25, HK_RANDOM_FROM=0.999, 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 (1024-bit key) header.d=linux.dev 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 9gIg4OoyY6Fs; Fri, 23 Oct 2026 17:33:55 +0300 (MSK) X-Received-SPF: Pass (mailfrom) identity=mailfrom; client-ip=172.234.253.10; helo=sea.lore.kernel.org; envelope-from=netdev+bounces-351111-linux-kernel-netdev=dewy.ru@vger.kernel.org; receiver=<UNKNOWN> X-Authentication-Results: OpenDMARC; dmarc=fail (p=none dis=none) header.from=linux.dev X-Received: from sea.lore.kernel.org (sea.lore.kernel.org [172.234.253.10]) by mail.dewy.ru (Postfix) with ESMTPS id 19CB71114E4; Fri, 23 Oct 2026 17:33:43 +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 94A2F2FC43; Fri, 23 Oct 2026 14:30:25 +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=1792765825; b=WnkqnhcywEXpKM+rK+b/7KJfcBBdvOAEzBGto30gMuQuMD1iZ7euZYlTyFNvVuPCSPAB +NMCJcqIE2UvvugxfviVuAN4BJmWvrs8tVJjsUzeKCzUZ1SaVhu2vMEAcIaE2AvXYk4nB hW3cf+OLaJ0ZZjpBQIPtpqPLiZLUPVVG0jDTQbe4DwzCJWOViEG8SLKUbELITtWW7pb0G R0XTCJtDm9j0y1/yLP2l5f8ywx61h71nnc/+7x6N4XbkEunrYgyEIhh+pEqr2TN2appV7 D+NU5LBFvzLp2jRtXtCxRzK4ttlfqUswq6tXwnhWc5DE13DgNdejQcRQWQ++HTK5p/g== X-ARC-Message-Signature: i=2; d=subspace.kernel.org; s=arc20261015; a=rsa-sha256; c=relaxed/relaxed; t=1792765825; h=X-Original-To:Received:DMARC-Filter:X-Envelope-To:DKIM-Signature: X-Envelope-To:Received:X-Mizu-Trace-ID:X-Migadu-Flow: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:From:In-Reply-To:Content-Type: Content-Transfer-Encoding; bh=q19RkNdvdKZfvvzc83oRnTfA/45ChJc0dIPYMhstJII=; b=mUbEQbVT3SeGuNuYmn242gcUj+YiF+yd68ZniWI+B/MeO9Py8w+/vzKXaO4hwT4dJ507 iiQZLfb6mkXMHht3TwTTifDWEF9XsyWrxcX8y8g8yFo4V7bmfFGk4hZZvMO3YZ5sTIMcj Fbie9C+S6P8/kXIWsbCZU9NHSDIour//9dGVIfJa9bT441s8szx4EiN/DlICsRA1l2cgI 6hjzmlI6OpsJXvOe0Zt/23wGEOhr4rfz2OTBcdux7gOw4e5+HYmAAq3iEKykJ0LXjUkC1 g9kXoXb4YQCvXlRP3+cc5BU71ka3SRxZa+dz9FAjQSyo6AKahVfhX5Z02K0nMgeKx6w== X-ARC-Authentication-Results: i=2; smtp.subspace.kernel.org; dkim=pass header.d=linux.dev header.i=@linux.dev header.a=rsa-sha256 header.s=key1 header.b=k3pjAgHg; dmarc=pass header.from=linux.dev; spf=pass smtp.mailfrom=linux.dev; 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 6B99A606A321; Fri, 23 Oct 2026 14:30:25 +0000 (UTC) X-Authentication-Results: smtp.subspace.kernel.org; dkim=pass (1024-bit key, unprotected) header.d=linux.dev header.i=@linux.dev header.a=rsa-sha256 header.s=key1 header.b=k3pjAgHg X-Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.remote-ip=95.215.58.214 X-ARC-Seal: i=1; d=subspace.kernel.org; s=arc20261015; a=rsa-sha256; cv=none; t=1792765824; b=IAw6b/oM9QQOw1o/iZgNEBzlop8ATYTku6KT/sXnXT0rGB4GmLVQC39rJqBpEHOuFHIj NupaK4OXKKZgr/Kz8JRIofngBJXTnlWVQGEiLjTjxoIko1uYumXvX6iGKsv34MZbLiGHQ DnZ2RGZ46GmIGGLZ7eLWN9wEDMkj40Br/y7Tf7my4x7fAr8sOFOHXLUNwGoK1of3ScAtN CD18Nq8OnIXn/PJ08mUTC1yqmXySfAIhFHQt6ZzWg+8+8AOxo0HcmebC7VZMgVEzl38fO JOZrHl8bBNjOWxdAFEBVhMDpKWogq6eBZFWP6OXnATcBQZOvmXgMnZmcp/bxdFS971A== X-ARC-Message-Signature: i=1; d=subspace.kernel.org; s=arc20261015; a=rsa-sha256; c=relaxed/relaxed; t=1792765824; h=DMARC-Filter:X-Envelope-To:DKIM-Signature:X-Envelope-To:Received: X-Mizu-Trace-ID:X-Migadu-Flow:Message-ID:Date:MIME-Version:User-Agent: Subject:To:Cc:References:From:In-Reply-To:Content-Type: Content-Transfer-Encoding; bh=q19RkNdvdKZfvvzc83oRnTfA/45ChJc0dIPYMhstJII=; b=YmaW4iuu5I0xXQPP30traqRVoWgsh2mPPRSFvw59cD1XxrcYv6V9qi/1px8s0+OkkHYM lRE2M+xnqMuLqPlmarGT2WyePqyZ0mCP06vo5F3fu5jGn2dsPf9MH+dOl2SBg+aymHAEa Kp99J4WH/QQJlgoUWuh4bAdts0AB284oSrCme2ifyg9oN5ktUbcegPbcex7swnOyxNijY j1H5+TVn10T/0yS2aKYHCUD8VFYmH2m9DC1NtRM0PRPSGb69q2GSJ68cLlZvhkXAkXZBJ QYizsAReKk4LngH+wuYatg968i8ZJDRMFsoFwrW7RSCnaEjX14JRz8hD7TJPaNZErng== X-ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass header.from=linux.dev; spf=pass smtp.mailfrom=linux.dev; dkim=pass header.d=linux.dev header.i=@linux.dev header.a=rsa-sha256 header.s=key1 header.b=k3pjAgHg; arc=none smtp.remote-ip=95.215.58.214 X-Received: from mta1.migadu.com (out-214.mta1.migadu.com [95.215.58.214]) (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 19955606A31E for <netdev@vger.kernel.org>; Fri, 23 Oct 2026 14:30:22 +0000 (UTC) X-DMARC-Filter: OpenDMARC Filter v1.4.2 smtp.subspace.kernel.org 19955606A31E X-Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=linux.dev X-Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=linux.dev X-Envelope-To: netdev@vger.kernel.org X-DKIM-Signature: a=rsa-sha256; bh=QkcatS4DUjgzNkAwRB16tzNFXXT1nPzIZUkqpGpZ14s=; c=simple/simple; d=linux.dev; h=from:to:subject:date:message-id:mime-version:content-type; s=key1; t=1792765821; v=1; x=1793370621; b=k3pjAgHgYsLIRxQBcdFSer+LE5OnuGJ3OE5BOl84/3/RIHVIYsitCwGCmxV6HltaC/xYc0v8 WbajW2iIx8mHJvzF5hJB/k5no1yfZ3XY2a8pmfKtQOg9KYHFIaaSBSxyDGAJpxHegpx0Ly5B9tI fUmS/izzsyfyDh16XE3i5Ej4= X-Envelope-To: netdev@vger.kernel.org X-Received: by smtp.migadu.com with ESMTPS id e015806712496f69; Fri, 23 Oct 2026 14:30:20 +0000 X-Mizu-Trace-ID: e015806712496f69 X-Migadu-Flow: FLOW_OUT 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: netdev@vger.kernel.org, stable@vger.kernel.org, "David S. Miller" <davem@davemloft.net>, Eric Dumazet <edumazet@kernel.org>, Jakub Kicinski <kuba@kernel.org>, Paolo Abeni <pabeni@redhat.com>, Simon Horman <horms@kernel.org>, David Ahern <dsahern@kernel.org>, Ido Schimmel <idosch@nvidia.com>, Kuniyuki Iwashima <kuniyu@google.com>, Chia-Yu Chang <chia-yu.chang@nokia-bell-labs.com>, Wyatt Feng <bronzed_45_vested@icloud.com>, Yung Chih Su <yuuchihsu@gmail.com>, Hannes Frederic Sowa <hannes@stressinduktion.org>, Flavio Leitner <fbl@redhat.com>, Petr Mladek <pmladek@suse.com>, "Paul E. McKenney" <paulmck@kernel.org>, linux-kernel@vger.kernel.org X-In-Reply-To: <27876dee-435f-4ea7-afed-69f8366e1c62@suse.de>