[pve-devel] [PATCH pve-container] set memory.kmem.limit_in_bytes

Wolfgang Bumiller w.bumiller at proxmox.com
Thu Nov 19 10:19:46 CET 2015


Memcg/kmem reclaim support has been merged since kernel 4.1,
so it makes sense to include this.

Closes #820
---
 Not sure if this is strictly necessasry as kmem counts into the same
 main memory counter and a simple :(){:|:&};: bomb behaves the same with
 and without. Anyway, from Documentation/cgroups/memory.txt:

    U != 0, K = unlimited:
    This is the standard memcg limitation mechanism already present before kmem
    accounting. Kernel memory is completely ignored.

    U != 0, K >= U:
    Since kmem charges will also be fed to the user counter and reclaim will be
    triggered for the cgroup for both kinds of memory. This setup gives the
    admin a unified view of memory, and it is also useful for people who just
    want to track kernel memory usage.

 src/PVE/LXC.pm | 1 +
 1 file changed, 1 insertion(+)

diff --git a/src/PVE/LXC.pm b/src/PVE/LXC.pm
index b788a5a..dd2e7f4 100644
--- a/src/PVE/LXC.pm
+++ b/src/PVE/LXC.pm
@@ -1096,6 +1096,7 @@ sub update_lxc_config {
 
     my $lxcmem = int($memory*1024*1024);
     $raw .= "lxc.cgroup.memory.limit_in_bytes = $lxcmem\n";
+    $raw .= "lxc.cgroup.memory.kmem.limit_in_bytes = $lxcmem\n";
 
     my $lxcswap = int(($memory + $swap)*1024*1024);
     $raw .= "lxc.cgroup.memory.memsw.limit_in_bytes = $lxcswap\n";
-- 
2.1.4





More information about the pve-devel mailing list