Re: [PATCH v2 4/7] xen: move max_pfn in xen_memory_setup() out of function scope

From: Jürgen Groß
Date: Thu Aug 22 2024 - 07:38:15 EST


On 20.08.24 10:44, Jan Beulich wrote:
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);

I just did a mechanical change for all uses of max_pfn.

I agree that your suggestion is an improvement, so I'll modify the
code.


Juergen

Attachment: OpenPGP_0xB0DE9DD628BF132F.asc
Description: OpenPGP public key

Attachment: OpenPGP_signature.asc
Description: OpenPGP digital signature