[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] Re: [Xen-users] Purpose of mem-max command
On Sat, Oct 10, 2015 at 6:36 PM, Simon Hobson <linux@xxxxxxxxxxxxxxxx> wrote: > Marco Guazzone <marco.guazzone@xxxxxxxxx> wrote: > >> I don't understand the behavior of the "xl mem-max" command. >> >> The help says: "Set the maximum amount reservation for a domain." >> But if I try to use it I see no effect on the target domain. >> >> It seems that only the "xl mem-set" command has effect on the VM. > > That sounds correct. mem-max sets the maximum that mem-set can configure. I > can't see that it's that useful from the command line, but I have mem-max set > is several of my config files where I want to start a machine with a > configured amount of ram, but have the option to increase it later (typically > because I've had to cut some machines down to shoehorn another VM onto the > host) > Hi Simon, What I don't understand is how to use it effectively. Could you provide a practical example of how to use it? Let me show you some of tests I've done (sorry for the length of the message). Before performing a test, I always reboot the VM to cancel the effects of previous tests My CentOS 7 VM, called 'memtest', is statically configured (in the config file) to have 8GB of memory: maxmem = 8192 memory = 8192 Indeed, once booted I get $ xl list Name ID Mem VCPUs State Time(s) Domain-0 0 71845 16 r----- 12630.1 memtest 35 7935 4 -b---- 10.0 and inside the VM [root@memtest ~]# free -h total used free shared buff/cache available Mem: 7.5G 106M 7.4G 8.3M 89M 7.3G Swap: 1.0G 0B 1.0G - TEST #1 $ xl mem-max memtest 3g libxl: error: libxl.c:3916:libxl_domain_setmaxmem: memory_static_max must be greater than or or equal to memory_dynamic_max : Success cannot set domid 35 static max memory to : 3g - TEST #2 $ xl mem-max memtest 10g $ xl list Name ID Mem VCPUs State Time(s) Domain-0 0 71845 16 r----- 12630.1 memtest 35 7935 4 -b---- 10.0 and inside the VM [root@memtest ~]# free -h total used free shared buff/cache available Mem: 7.5G 106M 7.4G 8.3M 89M 7.3G Swap: 1.0G 0B 1.0G Inside the VM, I run a program which tries to allocate 9GB of RAM (greater than the one statically configured but less than one dynamically assigned). It does so by calling "calloc(9*1024*1024*1024,1)". It fails returning the error: Cannot allocate memory. - TEST #3 $ xl mem-set memtest 10g libxl: error: libxl.c:4104:libxl_set_memory_target: memory_dynamic_max must be less than or equal to memory_static_max - TEST #4 $ xl mem-max memtest 10g $ xl mem-set memtest 10g libxl: error: libxl.c:4104:libxl_set_memory_target: memory_dynamic_max must be less than or equal to memory_static_max - TEST #5 $ xl mem-set memtest 4g $ xl list Name ID Mem VCPUs State Time(s) Domain-0 0 71845 16 r----- 12687.1 memtest 36 3839 4 -b---- 15.0 and inside the VM [root@memtest ~]# free -h total used free shared buff/cache available Mem: 3.5G 110M 3.3G 8.3M 89M 3.3G Swap: 1.0G 0B 1.0G Inside the VM, I run a program which tries to allocate 6GB of RAM (greater than the one dynamically assigned but less than one statically configured). It does so by calling "calloc(6*1024*1024*1024,1)". It fails returning the error: Cannot allocate memory. - TEST #6 $ xl mem-set memtest 4g $ xl mem-max memtest 4g $ xl list Name ID Mem VCPUs State Time(s) Domain-0 0 71845 16 r----- 12697.0 memtest 37 3839 4 -b---- 15.7 and inside the VM [root@memtest ~]# free -h total used free shared buff/cache available Mem: 3.5G 110M 3.3G 8.3M 89M 3.3G Swap: 1.0G 0B 1.0G Inside the VM, I run a program which tries to allocate 6GB of RAM (greater than the one dynamically assigned but less than one statically configured). It does so by calling "calloc(6*1024*1024*1024,1)". It fails returning the error: Cannot allocate memory. So, from these test it seems that the take-home lesson is to never use "xl mem-max" since it has no effect. Where am I wrong? Thank you very much for your help. Best, Marco _______________________________________________ Xen-users mailing list Xen-users@xxxxxxxxxxxxx http://lists.xen.org/xen-users
|
Lists.xenproject.org is hosted with RackSpace, monitoring our |