Re: [RFC PATCH v2 0/6] sysctl: replace overloaded extra pointers with typed bounds and core stride
From: David Laight
Date: Mon Nov 16 2026 - 16:40:30 EST
On Tue, 17 Nov 2026 00:07:32 +0800
wen.yang@xxxxxxxxx wrote:
> From: Wen Yang <wen.yang@xxxxxxxxx>
>
> 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().
>
> 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
> squashed commit to ensure the tree builds and tests pass cleanly.
I think I would have tried to avoid the indentation changes - just to
make the actual changes easier to see.
...
> 4. Baseline rebase & conflict resolution:
> - Rebased onto next-20261111 (aaa2f954c21b).
> - Added proc_dointvec_jiffies_minmax and proc_dointvec_ms_jiffies_minmax
> to sysctl_check_table().
I didn't spot those in here, but are they even needed?
Without the bounds don't the minmax variants behave like the original functions?
So it was only necessary to add support for bounds to the existing functions.
(The only think that half makes sense is if a caller uses extra1/2 for
something else.)
Related, I think you can reduce the size of the final patch and the likely hood
of some silly errors by making the 'dointvec' functions treat min == 0, max == 0
(ie no initialisers) as 'no limit' rather than 'only zero allowed'.
David