Message ID | 20220425033934.68551-8-kirill.shutemov@linux.intel.com (mailing list archive) |
---|---|
State | New |
Headers | show |
Series | mm, x86/cc: Implement support for unaccepted memory | expand |
On Mon, Apr 25, 2022 at 06:39:29AM +0300, Kirill A. Shutemov wrote: > A given page of memory can only be accepted once. The kernel has a need > to accept memory both in the early decompression stage and during normal > runtime. > > A bitmap used to communicate the acceptance state of each page between the nit: s/bitmap used/bitmap is used/ [snip]
On Mon, Apr 25, 2022 at 06:39:29AM +0300, Kirill A. Shutemov wrote: > A given page of memory can only be accepted once. The kernel has a need s/has a need to/has to/ > to accept memory both in the early decompression stage and during normal > runtime. > > A bitmap used to communicate the acceptance state of each page between the ^ is > decompression stage and normal runtime. > > boot_params is used to communicate location of the bitmap through out throughout > the boot. The bitmap is allocated and initially populated in EFI stub. > Decompression stage accepts pages required for kernel/initrd and mark marks > these pages accordingly in the bitmap. The main kernel picks up the > bitmap from the same boot_params and uses it to determinate what has to determine > be accepted on allocation. > > In the runtime kernel, reserve the bitmap's memory to ensure nothing > overwrites it. > > The size of bitmap is determinated with e820__end_of_ram_pfn() which Unknown word [determinated] in commit message. Suggestions: ['determinate', 'determined', 'terminated', 'determinant']
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); + } + /* * The bootstrap memblock region count maximum is 128 entries * (INIT_MEMBLOCK_REGIONS), but EFI might pass us more E820 entries