[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] Re: [MINI-OS PATCH 06/19] mm: don't add module pages to free memory
On 08.07.25 23:14, Jason Andryuk wrote: On 2025-07-02 04:12, Juergen Gross wrote:When initializing the memory allocator, don't add memory pages of modules and the initial boot info structure to the free memory. This is relevant only when running in PVH mode, as in PV mode only memory above the initial page tables is added to free memory, and the module and start_info pages are below the page tables. Signed-off-by: Juergen Gross <jgross@xxxxxxxx> +/* Reserved memory ranges not added to free memory. */ +#define MAX_RSV_RANGES 1 +static struct { + unsigned long start; + unsigned long size; +} reserved_range[MAX_RSV_RANGES]; + +void check_memory_range(unsigned long *from, unsigned long *to) +{ + unsigned int m; + struct hvm_modlist_entry *mod; + + for ( m = 0; m < MAX_RSV_RANGES && reserved_range[m].size; m++ ) + check_memory_range_conflict(from, to, reserved_range[m].start, + reserved_range[m].size);reserved_range[] isn't updated, so this is dead code. I guess that is fine for now. I thought so, yes. It felt more natural to add it in this patch. + + mod = (struct hvm_modlist_entry *)(unsigned long) + hvm_start_info_ptr->modlist_paddr; + for ( m = 0; m < hvm_start_info_ptr->nr_modules; m++ ) + check_memory_range_conflict(from, to, mod[m].paddr, mod[m].size); +} +static const struct {@@ -888,6 +964,10 @@ void arch_init_mm(unsigned long* start_pfn_p, unsigned long* max_pfn_p)if ( max_pfn >= MAX_MEM_SIZE / PAGE_SIZE ) max_pfn = MAX_MEM_SIZE / PAGE_SIZE - 1; +#ifndef CONFIG_PARAVIRT + pvh_reserve_start_info(&start_pfn); +#endifMaybe this ifdef can be removed and arch_mm_preinit() can call pvh_reserve_start_info() and update first_free_pfn (which is assigned to start_pfn)? Yes, that should be possible. Thanks for the idea, I'll modify the patch. Juergen Attachment:
OpenPGP_0xB0DE9DD628BF132F.asc Attachment:
OpenPGP_signature.asc
|
![]() |
Lists.xenproject.org is hosted with RackSpace, monitoring our |