Re: [PATCH v2 2/2] mm/memblock: only mark/clear KHO scratch memory when needed
From: Pratyush Yadav
Date: Thu Nov 27 2025 - 16:31:04 EST
On Thu, Nov 27 2025, Usama Arif wrote:
> On 27/11/2025 20:55, Andrew Morton wrote:
>> On Thu, 27 Nov 2025 20:33:20 +0000 Usama Arif <usamaarif642@xxxxxxxxx> wrote:
>>
>>> The scratch memory for kexec handover is used to bootstrap the
>>> kexec'ed kernel. It is only needed when CONFIG_KEXEC_HANDOVER
>>> is enabled and only if it is a KHO boot. Add checks to prevent
>>> marking a KHO scratch region unless needed.
>>
>> What effect does this change have? Lessened memory consumption,
>> presumably. Of what magnitude and for what time period?
>
> For some context, this came out of https://lore.kernel.org/all/ba690e06-c2a1-4d2e-9428-9ca2ea9f2b86@xxxxxxxxx/
> (I should have probably added that in the commit message..)
> We are experiencing several warnings a day in meta fleet due to a warning introduced
> in that patch. We dont have CONFIG_KEXEC_HANDOVER enabled in the fleet. The IMA memory
> seems to conincide with the 1st MB, but as Mike pointed out they are different arrays
> so this scratch memory is likely not a cause of the warnings. But it is not useful (and
> was a bit confusing) seeing KHO scratch memory being marked even when KHO is disabled.
Yeah, it is not yet clear if this is really the root cause for your
issue.
>
> The imapct is as you said, but its only marked for a very short period of time.
> I think a better reason for this patch is just to not mark the memory at all when KHO
> is disabled (or not in use) for clarity.
Yeah, I don't think it will have much of a difference in practice, but I
do think it is a good correctness fix. Marking the lower 1M as scratch
is a hack to get around the limitations with KHO, and we should not be
doing that when KHO isn't involved.
--
Regards,
Pratyush Yadav