HI Balbir,
The total RAM in the machine is 8002MB and the swap space is 471MB. The cgroup where apache runs is restricted to 6000MB. I would like to keep apache from swapping at all if possible, so have set memory.swappiness low and would like to set memory.memsw.limit_in_bytes to the same value as memory.limit_in_bytes or only a few MB higher if possible. Thanks, Andrew ----- Original Message ----- From: "Balbir Singh" <bsinghar...@gmail.com> To: "Andrew Martin" <amar...@xes-inc.com> Cc: libcg-devel@lists.sourceforge.net Sent: Tuesday, May 1, 2012 2:40:59 AM Subject: Re: [Libcg-devel] Cannot set memory.memsw.limit_in_bytes On Wed, Apr 25, 2012 at 7:21 AM, Andrew Martin < amar...@xes-inc.com > wrote: Hello, I am running a VM with Ubuntu Server 10.04 amd64. I have installed and configured cgroups to limit the resources available to samba, nfs, and apache. My configuration is as follows: /etc/cgconfig.conf group nfs { memory { memory.limit_in_bytes = 500M; memory.memsw.limit_in_bytes = 1000M; } cpu { cpu.shares = 10; } } group smb { memory { memory.limit_in_bytes = 1500M; memory.memsw.limit_in_bytes = 2000M; } cpu { cpu.shares = 13; } } group apache { memory { memory.limit_in_bytes = 6G; memory.memsw.limit_in_bytes = 6G; memory.swappiness = 5; } cpu { cpu.shares = 100; } } mount { cpu = /mnt/cgroups/cpu; cpuacct = /mnt/cgroups/cpuacct; memory = /mnt/cgroups/memory; cpuset = /mnt/cgroups/cpuset; } /etc/cgrules.conf ## Samba Server root:/usr/sbin/smbd cpu,memory smb/ root:/usr/sbin/nmbd cpu,memory smb/ ## NFS Server root:/usr/sbin/exportfs cpu,memory nfs/ root:/usr/sbin/rpc.mountd cpu,memory nfs/ root:/usr/sbin/rpc.nfsd cpu,memory nfs/ root:/usr/sbin/rpc.svcgssd cpu,memory nfs/ root:nfsd cpu,memory nfs/ root:nfsd4 cpu,memory nfs/ ## Apache Webserver root:apache2 cpu,memory apache/ www-data cpu,memory apache/ Both memory.limit_in_bytes and memory.memsw.limit_in_bytes seem to work fine for the smb cgroup, but no matter what values I use for the apache cgroup I cannot set memory.memsw.limit_in_bytes. How much total memory do you have on the system? How is total RAM + Swap? <blockquote> My goal is to disable apache's ability to swap by setting memory.limit_in_bytes and memory.memsw.limit_in_bytes to the same value (or memory.memsw.limit_in_bytes slightly higher). After running "service cgconfig restart" to restart the cgconfig service, I check the value of memory.limit_in_bytes and memory.memsw.limit_in_bytes for the apache group: # cat /mnt/cgroups/memory/apache/ memory.limit_in_bytes 6442450944 # cat /mnt/cgroups/memory/apache/ memory.memsw.limit_in_bytes 9223372036854775807 The value for memory.memsw.limit_in_bytes is not being initialized. I cannot find any related errors in /var/log. I have tried a number of different values for memory.memsw.limit_in_bytes, however it will not initialize properly. The only error I can see occurs when I restart the cgroups service: Stopping cgconfig service: rmdir: failed to remove `./smb': Device or resource busy sed: couldn't flush stdout: No such process rmdir: failed to remove `./sysdefault': Device or resource busy sed: couldn't flush stdout: No such process rmdir: failed to remove `./sysdefault': Device or resource busy sed: couldn't flush stdout: Invalid argument rmdir: failed to remove `./sysdefault': Device or resource busy * Starting cgconfig service: What else can I try in order to properly initialize memory.memsw.limit_in_bytes? I can temporarily echo a value to it (e.g. echo 6442450944 > /mnt/cgroups/memory/apache/ memory.memsw.limit_in_bytes) which does appear to work , but would prefer a permanent solution. </blockquote> I'll try and reproduce your problem once I get the HW info above Balbir ------------------------------------------------------------------------------ Live Security Virtual Conference Exclusive live event will cover all the ways today's security and threat landscape has changed and how IT managers can respond. Discussions will include endpoint security, mobile security and the latest in malware threats. http://www.accelacomm.com/jaw/sfrnl04242012/114/50122263/ _______________________________________________ Libcg-devel mailing list Libcg-devel@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/libcg-devel