Re: [PATCHv7 08/14] x86/mm: Reserve unaccepted memory bitmap

From: Borislav Petkov
Date: Tue Jul 26 2022 - 05:07:27 EST


On Tue, Jun 14, 2022 at 03:02:25PM +0300, Kirill A. Shutemov wrote:
> diff --git a/arch/x86/kernel/e820.c b/arch/x86/kernel/e820.c
> index f267205f2d5a..22d1fe48dcba 100644
> --- a/arch/x86/kernel/e820.c
> +++ b/arch/x86/kernel/e820.c
> @@ -1316,6 +1316,16 @@ void __init e820__memblock_setup(void)
> int i;
> u64 end;
>
> + /* Mark unaccepted memory bitmap reserved */
> + if (boot_params.unaccepted_memory) {
> + unsigned long size;
> +
> + /* One bit per 2MB */
> + size = DIV_ROUND_UP(e820__end_of_ram_pfn() * PAGE_SIZE,
> + PMD_SIZE * BITS_PER_BYTE);
> + memblock_reserve(boot_params.unaccepted_memory, size);
> + }
> +

Hmm, I don't like how this is dropped right in the middle of a unrelated
function.

You're adding arch/x86/mm/unaccepted_memory.c later. Why don't you put
that chunk in a function there which is called by early_reserve_memory()
which does exactly what you want - reserve memory early, before memblock
allocations?

Hmm.

--
Regards/Gruss,
Boris.

https://people.kernel.org/tglx/notes-about-netiquette