Hotplug memory calculation

next40

Member
May 31, 2021
12
1
23
39
Hi all!
I trying for understading logic of memory calculate for vm guests with enabled memory hotplug on latest PVE 7

i set system params:
cat /sys/module/vhost/parameters/max_mem_regions
509

based on on post:
https://forum.proxmox.com/threads/vm-windows-cannot-start-with-ram-more-48gb.76617/

for example i try calc 120 gb mem for guest:

  1. 1024M static memory
  2. up to 32 512M dimms
  3. up to 32 1024M dimms
  4. up to 32 2048M dimms
  5. ...
120GB = 122880 MiB
1. 122880 - 1024( static memory ) = 121856
2. 32 dimm 512M = 16384
3. 32 dimm 1024M = 32768
4. 32 dimm 2048M = 65636
5. 1 or 2 dimm 4096 = 4096 or 8192

121856 - 114688(sum 2,3,4) = 7168 ~ 1 or 2 dimms with size 4096
114688 + 4096 = 118784 = TASK ERROR: memory size (118784) must be aligned to 4096 for hotplugging
114688 + 8192 = 122880 = TASK ERROR: memory size (122880) must be aligned to 4096 for hotplugging

what is correct logic of calculation??? thx.
 
Last edited:
do you have hugepages enabled? with those, the calculation is different:
1024MB static memory PER SOCKET
dimms start at 1024MB, not 512MB
 
do you have hugepages enabled? with those, the calculation is different:
1024MB static memory PER SOCKET
dimms start at 1024MB, not 512MB

cat /proc/meminfo | grep -i huge
AnonHugePages: 0 kB
ShmemHugePages: 0 kB
FileHugePages: 0 kB
HugePages_Total: 0
HugePages_Free: 0
HugePages_Rsvd: 0
HugePages_Surp: 0
Hugepagesize: 2048 kB
Hugetlb: 0 kB

what profit of enable hugepages??
 
ah, sorry, your calculation in the first post is wrong

32 dimms each for 512, 1024, 2048 = 114688MB of RAM. plus the 1024M static RAM makes 115712. add another 4096MB dimm and you are at 119808. add another one and you are at 123904. so basically the aligned memory sizes for your DIMM configuration (without huge pages) is 117GB or 121GB. with 1G huge pages it's the same with a single socket, just with less DIMMs. with more sockets, the alignment changes by 1G for each socket (with 2 sockets, 118GB and 122GB are aligned, with 3 sockets 119GB and 123GB, and so on).