[pve-devel] [PATCH v3 qemu-server 09/13] memory: use 64 slots && static dimm size when max is defined

Fiona Ebner f.ebner at proxmox.com
Fri Feb 3 14:45:41 CET 2023


Am 02.02.23 um 12:03 schrieb Alexandre Derumier:
> @@ -179,17 +185,17 @@ sub get_numa_guest_to_host_map {
>  }
>  
>  sub foreach_dimm{
> -    my ($conf, $vmid, $memory, $sockets, $func) = @_;
> +    my ($conf, $vmid, $memory, $current_size, $func) = @_;

The parameter should not be called $current_size if you pass in
$static_memory (they're only the same value if nothing is yet
hotplugged). It's also not nice to use parameters as local variables.
Renaming the parameter to $static_memory and doing
my $current_size = $static_memory;
is cleaner.

I know I'm saying this often, but changing the argument here should be
its own patch. It has nothing to do with 'max'.

>  
>      my $dimm_id = 0;
> -    my $current_size = 0;
>      my $dimm_size = 0;
>  
> -    if($conf->{hugepages} && $conf->{hugepages} == 1024) {
> -	$current_size = 1024 * $sockets;
> +    my $confmem = parse_memory($conf->{memory});
> +    if ($confmem->{max}) {
> +	$dimm_size = $confmem->{max} / $MAX_SLOTS;
> +    } elsif($conf->{hugepages} && $conf->{hugepages} == 1024) {
>  	$dimm_size = 1024;
>      } else {
> -	$current_size = 1024;
>  	$dimm_size = 512;
>      }
>  





More information about the pve-devel mailing list