Re: [PATCH 1/3] x86: fix access_ok() and valid_user_address() using wrong USER_PTR_MAX in modules
From: David Laight
Date: Thu Nov 06 2025 - 14:26:49 EST
On Thu, 6 Nov 2025 14:19:06 +0100
Mateusz Guzik <mjguzik@xxxxxxxxx> wrote:
> On Thu, Nov 6, 2025 at 2:10 PM Borislav Petkov <bp@xxxxxxxxx> wrote:
> >
> > On Thu, Nov 06, 2025 at 01:06:06PM +0100, Mateusz Guzik wrote:
> > > I don't know what are you trying to say here.
> > >
> > > Are you protesting the notion that reducing cache footprint of the
> > > memory allocator is a good idea, or perhaps are you claiming these
> > > vars are too problematic to warrant the effort, or something else?
> >
> > I'm saying all work which does not change the code in a trivial way should
> > have numbers to back it up. As in: "this change X shows this perf improvement
> > Y with the benchmark Z."
> >
> > Because code uglification better have a fair justification.
> >
> > Not just random "oh yeah, it would be better to have this." If the changes are
> > trivial, sure. But the runtime const thing was added for a very narrow case,
> > AFAIR, and it wasn't supposed to have a widespread use. And it ain't that
> > trivial, codewise.
> >
> > IOW, no non-trivial changes which become a burden to maintainers without
> > a really good reason for them. This has been the guiding principle for
> > non-trivial perf optimizations in Linux. AFAIR at least.
> >
> > But hey, what do I know...
>
> Then, as I pointed out, you should be protesting the patching of
> USER_PTR_MAX as it came with no benchmarks and also resulted in a
> regression.
>
IIRC it was a definite performance improvement for a specific workload
(compiling kernels) on a system where the relatively small d-cache
caused significant overhead reading the value from memory.
Look at the patch author for more info.
David