Re: [PATCH v3 2/2] ksm: Optimize rmap_walk_ksm by passing a suitable address range

Lorenzo Stoakes
2026-04-08T06:30:04Z

On Tue, Apr 07, 2026 at 02:21:42PM -0700, Andrew Morton wrote:
> On Tue, 7 Apr 2026 10:43:12 +0100 "Lorenzo Stoakes (Oracle)" <ljs@kernel.org> wrote:
>
> > > Thanks, Hugh. Administreevia:
> > >
> > > I've removed this patch from the mm-stable branch and I reworked its
> > > [1/2] "ksm: initialize the addr only once in rmap_walk_ksm" to be
> > > presented as a singleton patch.
> > >
> > > For now I've restaged this patch ("ksm: optimize rmap_walk_ksm by
> > > passing a suitable address range") at the tail of the mm-unstable
> > > branch and I'll enter wait-and-see mode.
> > >
> >
> > Given we're at -rc7 now, I think we should delay this patch until 7.2, unless
> > I'm much mistaken wrt Hugh's concerns.
> >
> > I'm concerned this is a subtle way of breaking things so we really want to be
> > confident.
> >
> > We should also bundle up the test at
> > https://lore.kernel.org/all/20260407140805858ViqJKFhfmYSfq0FynsaEY@zte.com.cn/
> > with this patch (should we find it's ok) as a separate series.
> >
> > Really overall I think safest to yank until 7.2 honestly.
>
> OK. But let's not lose sight of those potential efficiency gains:
>
> Time_ms Nr_iteration_total Skip_addr_out_of_range Skip_mm_mismatch
> Before: 228.65 22169 22168 0
> After : 0.396 3 0 2
>

Yes, sure. We could possibly achieve similar by doing a quick search first then
trying the broader search as suggested by Hugh?

But want to make sure correctness is there!

Thanks, Lorenzo