Re: [PATCH v2 4/7] xen: move max_pfn in xen_memory_setup() out of function scope
From: Jan Beulich
Date: Tue Aug 20 2024 - 04:45:48 EST
On 20.08.2024 10:20, Juergen Gross wrote:
> Instead of having max_pfn as a local variable of xen_memory_setup(),
> make it a static variable in setup.c instead. This avoids having to
> pass it to subfunctions, which will be needed in more cases in future.
>
> Rename it to ini_nr_pages, as the value denotes the currently usable
> number of memory pages as passed from the hypervisor at boot time.
>
> Signed-off-by: Juergen Gross <jgross@xxxxxxxx>
> Tested-by: Marek Marczykowski-Górecki <marmarek@xxxxxxxxxxxxxxxxxxxxxx>
Reviewed-by: Jan Beulich <jbeulich@xxxxxxxx>
I wonder though why ...
> @@ -712,9 +713,9 @@ char * __init xen_memory_setup(void)
> int op;
>
> xen_parse_512gb();
> - max_pfn = xen_get_pages_limit();
> - max_pfn = min(max_pfn, xen_start_info->nr_pages);
> - mem_end = PFN_PHYS(max_pfn);
> + ini_nr_pages = xen_get_pages_limit();
> + ini_nr_pages = min(ini_nr_pages, xen_start_info->nr_pages);
... this can't be just
ini_nr_pages = min(xen_get_pages_limit(), xen_start_info->nr_pages);
Jan