Re: [PATCH] x86/alternative: delay freeing of smp_locks section

From: Mike Rapoport

Date: Mon Mar 30 2026 - 13:16:42 EST


On Sat, Mar 28, 2026 at 08:58:27PM +0100, Borislav Petkov wrote:
> On Sat, Mar 28, 2026 at 03:39:15PM +0300, Mike Rapoport wrote:
> > It's as old as CONFIG_DEFERRED_STRUCT_PAGE_INIT (v4.2) or even before that.
> > If you think that fixing this leak is important enough to backport, it
> > affects all mainlined stable releases.
>
> Probably not all but perhaps the last two - 6.12 and 6.18...
>
> > Yes, I added a WARN() in free_reserved_area() to lure such cases and
> > prevent them in the future.
>
> This warn is supposed to catch the leaks. I guess it is important enough to
> add the warning so it is just as important to fix them leaks, right :-)

After sleeping on it, I realised there was no leak, and this is only an
integration issue of recent memblock changes, so there's no need for cc
@stable.

Since this fixes a fallout from memblock changes, I can take it together
with them via memblock tree with Ack from x86 folks if you prefer.

> As to the fix itself, arch_initcall() is the magic time where deferred
> initialization is complete, I presume?
>
> > I'll wait a bit for more comments before rewriting changelog and reposting.
>
> Yes please. You could also expand on why the arch initcall is the proper fix.
> I guess deferred init completes with an earlier initcall. So yeah, it would be
> good to have that written down explicitly too.
>
> On and pls use those tags:
>
> Tested-by: Bert Karwatzki <spasswolf@xxxxxx>
> Reported-by: Bert Karwatzki <spasswolf@xxxxxx>
> Link: https://lore.kernel.org/r/20260327140109.7561-1-spasswolf@xxxxxx
>
> Thx.
>
> --
> Regards/Gruss,
> Boris.
>
> https://people.kernel.org/tglx/notes-about-netiquette

--
Sincerely yours,
Mike.