Re: [RFC PATCH v2 0/6] sysctl: replace overloaded extra pointers with typed bounds and core stride

From: Joel Granados

Date: Thu Nov 26 2026 - 07:31:04 EST


On Thu, Nov 26, 2026 at 01:37:12AM +0800, Wen Yang wrote:
>
>
> On 11/24/26 21:26, Joel Granados wrote:
> > On Tue, Nov 17, 2026 at 12:07:32AM +0800, wen.yang@xxxxxxxxx wrote:
> > > From: Wen Yang <wen.yang@xxxxxxxxx>
> > 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".
> >
> > >
<... snip ...>
> > > 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.
FYI, I just sent out a new RFC [1] which has very little overlap (and we
should try to keep it that way) with your work here.

>
> 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.
Yes. That will take us to a place where we will have priv and extra{1,2}
at the same time. But will allow us to move the callers one by one.

Once all the callers are updated, we can eliminate/replace the
extra{1,2} as there is not other dependencies (that I know of)

>
> 2, Once the context pointer migration is settled, follow up with the
> typed min/max bound conversion as a separate series.
ACK

>
> 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?
No one is working on it to my knowledge. If you can come up with a way
to keep the poll without having it in ctl_table, that would be a win.

>
> 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.
That sounds good to me.


>
> Thanks,
> Wen
>

[1] https://lore.kernel.org/20261126-lklm-sysctl-ctx-flatarray-v1-0-d7fc9cc9b03e@xxxxxxxxxx

Attachment: signature.asc
Description: PGP signature