]> git.proxmox.com Git - pve-container.git/commitdiff
cgroup: get old swap value when hotplugging only memory
authorWolfgang Bumiller <w.bumiller@proxmox.com>
Fri, 10 Jul 2020 09:32:41 +0000 (11:32 +0200)
committerWolfgang Bumiller <w.bumiller@proxmox.com>
Fri, 10 Jul 2020 09:33:25 +0000 (11:33 +0200)
Signed-off-by: Wolfgang Bumiller <w.bumiller@proxmox.com>
src/PVE/LXC/CGroup.pm

index d6b27ea07d903518b132c8841a0cd5124f808aad..6710843a9a87c2a9fe8583b9eaac12d4b5d5ed5c 100644 (file)
@@ -422,7 +422,8 @@ sub change_memory_limit {
        chomp($old_mem_bytes, $old_memsw_bytes);
 
        $mem_bytes //= $old_mem_bytes;
-       my $memsw_bytes = defined($swap_bytes) ? ($mem_bytes + $swap_bytes) : $old_memsw_bytes;
+       $swap_bytes //= $old_memsw_bytes - $old_mem_bytes;
+       my $memsw_bytes = $mem_bytes + $swap_bytes;
 
        if ($memsw_bytes > $old_memsw_bytes) {
            # Growing the limit means growing the combined limit first, then pulling the