On Thu, May 28, 2026 at 8:37 AM Lorenzo Stoakes <[email protected]> wrote:
>
> On Tue, May 26, 2026 at 06:49:44PM -0700, Andrew Morton wrote:
> > On Thu, 21 May 2026 08:16:01 -0700 Suren Baghdasaryan <[email protected]>
> > wrote:
> >
> > > > > It might be but the point of this patchset (and the previous one that
> > > > > made a similar change for /proc/pid/maps) is to reduce mmap_lock
> > > > > contention, not to speed up the read operation, which is not a
> > > > > performance critical part.
> > > >
> > > > Well, this interface has been around .. forever, so if there is a
> > > > noticeable
> > > > change in performance it should be called out.
> > >
> > > Sorry, I missed your reply. I'll see if I can adopt Paul's test for
> > > /proc/pid/maps [1] for benchmarking smaps but I would expect similar
> > > results as was reported in [2].
> >
> > How's it coming along ;)
> >
> > > [1] https://github.com/paulmckrcu/proc-mmap_sem-test
> > > [2]
> > > https://lore.kernel.org/all/[email protected]/
> >
> > I've moved this series to the tail of mm-unstable to permit more time.
>
> Well I'm not sure it's _vital_ to get stats for this, it's pretty much an
> extension of existing VMA lock work in /proc/$pid/maps -> smaps, and the
> logic is sound.
>
> There's no reason to believe there will be anything other than a reduction
> in lock contention here at least under whichever workloads happen to hammer
> smaps, but doesn't feel like there's a downside!
Just finished running Paul's test. I ran a smaller number of
iterations (20 instead of 100) because it takes lots of time but
results are quite convincing.
In the baseline, all runs had maximum latencies exceeding 9.7
milliseconds. In contrast, the patched version has maximum latencies
in the range of 1.8-3.2 milliseconds.
Median performance of the baseline is at 1.135 milliseconds and patch
series at 7 microseconds.
Baseline
./run-proc-vs-map.sh --nsamples 20 --rawdata -- --busyduration 2
1.135 1.078 9.737
1.135 1.086 9.834
1.135 1.090 9.890
1.135 1.091 9.892
1.135 1.111 9.894
1.135 1.119 9.896
1.135 1.120 9.918
1.135 1.123 9.927
1.135 1.130 9.937
1.135 1.132 9.940
1.135 1.138 9.942
1.135 1.140 9.944
1.135 1.141 9.952
1.135 1.148 9.952
1.135 1.153 9.958
1.135 1.153 9.967
1.135 1.167 9.974
1.135 1.168 9.975
1.135 1.173 9.982
1.135 1.199 10.014
Patched
./run-proc-vs-map.sh --nsamples 20 --rawdata -- --busyduration 2
0.007 0.006 1.862
0.007 0.006 1.937
0.007 0.006 1.947
0.007 0.007 1.956
0.007 0.007 1.956
0.007 0.007 1.998
0.007 0.007 2.020
0.007 0.007 2.027
0.007 0.007 2.085
0.007 0.007 2.100
0.007 0.007 2.115
0.007 0.007 2.233
0.007 0.007 2.304
0.007 0.007 2.325
0.007 0.007 2.327
0.007 0.007 2.427
0.007 0.007 2.489
0.007 0.007 2.500
0.007 0.007 3.123
0.007 0.007 3.151
>
> Cheers, Lorenzo