From: Wen Yang <wen.yang@linux.dev>
To: Joel Granados <joel.granados@kernel.org>
Cc: David Laight <david.laight.linux@gmail.com>,
Kees Cook <kees@kernel.org>,
linux-fsdevel@vger.kernel.org, linux-kernel@vger.kernel.org
Subject: Re: [RFC PATCH v2 0/6] sysctl: replace overloaded extra pointers with typed bounds and core stride
Date: Thu, 26 Nov 2026 01:37:12 +0800 [thread overview]
Message-ID: <0e4be7f5-8704-4d2c-8e63-d578fad13774@linux.dev> (raw)
In-Reply-To: <awV04op6IxD2NWQA@hobbes>
On 11/24/26 21:26, Joel Granados wrote:
> On Tue, Nov 17, 2026 at 12:07:32AM +0800, wen.yang@linux.dev wrote:
>> From: Wen Yang <wen.yang@linux.dev>
> Thx for taking the time to put this out. This gives perspective and adds
> to the discussion of how best to move forward with "struct ctl_table".
>
>>
>> struct ctl_table has long relied on extra1 and extra2 pointers to serve
>> multiple unrelated duties, including range limits and caller-specific
>> context. This series addresses both:
>>
>> 1. Replace bound pointers with plain unsigned long min and max fields
>> directly in struct ctl_table.
>>
>> 2. Replace per-entry context pointers with a core stride mechanism,
>> allowing callers to register arrays of structures embedding struct
>> ctl_table and recover enclosing context via standard container_of().
> I think having these two at the same time is not the way to go. We need
> to figure out where to put the non-bound context pointers first. And
> after that is settled, we address the bound pointers.
>
> Yes, we are doing the first to get to the later, but mixing them just
> adds to the confusion. One thing at a time!
>
>>
>> This RFC focuses on the core stride infrastructure and two representative
>> complex users (netfilter nf_log and IPv4 devinet), as suggested by Joel
>> Granados. The remaining treewide callers are converted in a single
> My suggestion was **not** for this implementation specifically. I
> suggested you create an RFC to clearly understand your idea. Apologies
> if that was not clear.
>
>> squashed commit to ensure the tree builds and tests pass cleanly.
>>
>> Changes from v1:
>> =================
>> v1: https://lore.kernel.org/all/cover.1793204511.git.wen.yang@linux.dev/
>>
>> 1. Abandoned per-entry 'void *priv' (David Laight):
> Though not adding yet another entry in ctl_table is commendable, I
> prefer adding a priv entry over the stride mechanism in this series.
> Here are my thoughts:
>
> 1. The type should set the stride in sysctl core. The situation where
> the stride of a type might be different from its size should be avoided.
> In these cases I would prefer a whole new type.
>
> 2. Having ctl_table as the grounding entry inside another struct and, at
> the same time, it be a regular (non-grounding) entry is asking for
> trouble.
> - A proc_handler assumes there is a containing entry around only to
> realize that it was passed just a pointer.
> - The core might start overlaying clt_table entries to deal with
> namespaces [1], [2], [3]
>
>> - v1 added 'priv' to struct ctl_table, incurring 8 bytes on 64-bit and
>> 4 bytes on 32-bit for all ~1,000 entries across thousands of dynamic
>> instances, even though <7% of entries need context.
> Just a quick comment here: If you want to get rid of 8/4 bytes with the
> ctl_table struct, you might want to look at struct ctl_table_poll, which
> (to my knowledge) is only used in one ctl_table array. Finding a way to
> service utsname while at the same time removing that entry is much more
> of a low hanging fruit IMO.
>
Hi Joel,
Thanks for the detailed feedback and the namespace overlay pointers.
Our main motivation for prototyping the stride approach (and the v3 we
have been testing) was to avoid growing struct ctl_table while still
eliminating the per-entry wrapper functions. However, the upcoming
namespace table overlay work is a compelling reason to keep ctl_table
arrays homogeneous and self-contained.
Following your advice, we will set the stride series aside and split the
work into focused steps:
1, first, prepare a small, standalone series (based on the lastest -rc)
focused on migrating the non-bound context callers of extra1/extar2
to a dedicated void *priv, field in struct ctl_table, without
touching any min/max bounds yet.
2, Once the context pointer migration is settled, follow up with the
typed min/max bound conversion as a separate series.
Regarding struct ctl_table_poll in utsname: is someone already working
on removing it from struct ctl_table, or would you like us to look into
that as a separate cleanup as well?
We expect to have the context-pointer series ready in about 1 week.
Please let me know if you have any preferences or suggestions on this plan.
Thanks,
Wen
prev parent reply other threads:[~2026-11-25 17:37 UTC|newest]
Thread overview: 11+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-11-16 16:07 wen.yang
2026-11-16 16:07 ` [RFC PATCH v2 1/5] sysctl: add numeric bounds and core stride infrastructure wen.yang
2026-11-16 16:07 ` [RFC PATCH v2 2/5] sysctl: cover numeric bounds and table containers in KUnit wen.yang
2026-11-16 16:07 ` [RFC PATCH v2 3/5] netfilter: embed logger sysctl context using stride wen.yang
2026-11-16 16:07 ` [RFC PATCH v2 4/5] net/ipv4: embed device " wen.yang
2026-11-16 16:07 ` [RFC PATCH v2 5/5] scripts/coccinelle: add script to detect and convert sysctl bounds wen.yang
2026-11-16 21:40 ` [RFC PATCH v2 0/6] sysctl: replace overloaded extra pointers with typed bounds and core stride David Laight
2026-11-17 17:01 ` Wen Yang
2026-11-17 18:10 ` David Laight
2026-11-24 13:26 ` Joel Granados
2026-11-25 17:37 ` Wen Yang [this message]
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=0e4be7f5-8704-4d2c-8e63-d578fad13774@linux.dev \
--to=wen.yang@linux.dev \
--cc=david.laight.linux@gmail.com \
--cc=joel.granados@kernel.org \
--cc=kees@kernel.org \
--cc=linux-fsdevel@vger.kernel.org \
--cc=linux-kernel@vger.kernel.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox
all inboxes | Powered by JetHome®