[pve-devel] [PATCH 2/2] hugepages: use hostnodes value as numanode for topology

Wolfgang Bumiller w.bumiller at proxmox.com
Mon Aug 22 10:57:25 CEST 2016


applied

On Fri, Jul 29, 2016 at 05:17:34AM +0200, Alexandre Derumier wrote:
> also disallow more than 1 hostnode value
> 
> Signed-off-by: Alexandre Derumier <aderumier at odiso.com>
> ---
>  PVE/QemuServer/Memory.pm | 35 +++++++++++++++++++++++------------
>  1 file changed, 23 insertions(+), 12 deletions(-)
> 
> diff --git a/PVE/QemuServer/Memory.pm b/PVE/QemuServer/Memory.pm
> index 58c7217..37f285a 100644
> --- a/PVE/QemuServer/Memory.pm
> +++ b/PVE/QemuServer/Memory.pm
> @@ -230,17 +230,8 @@ sub config {
>  	    # hostnodes
>  	    my $hostnodelists = $numa->{hostnodes};
>  	    if (defined($hostnodelists)) {
> -		my $hostnodes;
> -		foreach my $hostnoderange (@$hostnodelists) {
> -		    my ($start, $end) = @$hostnoderange;
> -		    $hostnodes .= ',' if $hostnodes;
> -		    $hostnodes .= $start;
> -		    $hostnodes .= "-$end" if defined($end);
> -		    $end //= $start;
> -		    for (my $i = $start; $i <= $end; ++$i ) {
> -			die "host NUMA node$i doesn't exist\n" if ! -d "/sys/devices/system/node/node$i/";
> -		    }
> -		}
> +
> +		my $hostnodes = print_numa_hostnodes($hostnodelists);
>  
>  		# policy
>  		my $policy = $numa->{policy};
> @@ -311,6 +302,23 @@ sub print_mem_object {
>  
>  }
>  
> +sub print_numa_hostnodes {
> +    my ($hostnodelists) = @_;
> +
> +    my $hostnodes;
> +    foreach my $hostnoderange (@$hostnodelists) {
> +	my ($start, $end) = @$hostnoderange;
> +	$hostnodes .= ',' if $hostnodes;
> +	$hostnodes .= $start;
> +	$hostnodes .= "-$end" if defined($end);
> +	$end //= $start;
> +	for (my $i = $start; $i <= $end; ++$i ) {
> +	    die "host NUMA node$i doesn't exist\n" if ! -d "/sys/devices/system/node/node$i/";
> +	}
> +    }
> +    return $hostnodes;
> +}
> +
>  sub hugepages_mount {
>  
>     my $mountdata = PVE::ProcFSTools::parse_proc_mounts();
> @@ -406,9 +414,12 @@ sub hugepages_topology {
>  
>  	$numa_custom_topology = 1;
>  	my $numa_memory = $numa->{memory};
> +	my $hostnodelists = $numa->{hostnodes};
> +	my $hostnodes = print_numa_hostnodes($hostnodelists);
>  
> +        die "more than 1 hostnode value in numa node is not supported when hugepages are enabled" if $hostnodes !~ m/^(\d)$/;
>          my $hugepages_size = hugepages_size($conf, $numa_memory);
> -        $hugepages_topology->{$hugepages_size}->{$i} += hugepages_nr($numa_memory, $hugepages_size);
> +        $hugepages_topology->{$hugepages_size}->{$hostnodes} += hugepages_nr($numa_memory, $hugepages_size);
>  
>      }
>  
> -- 
> 2.1.4
> 
> _______________________________________________
> pve-devel mailing list
> pve-devel at pve.proxmox.com
> http://pve.proxmox.com/cgi-bin/mailman/listinfo/pve-devel
> 




More information about the pve-devel mailing list