mirror of
https://git.proxmox.com/git/qemu-server
synced 2025-08-12 00:44:33 +00:00
hugepages: fix memory size checking
The codepath for "any" hugepages did not check if memory size was even, leading to the code below trying to allocate half a hugepage (e.g. VM with 2049MiB RAM would lead to 1024.5 2kB hugepages). Also improve error message for systems with only 1GB hugepages enabled. Signed-off-by: Stefan Reiter <s.reiter@proxmox.com>
This commit is contained in:
parent
331a5079e1
commit
062a7ea714
@ -402,10 +402,11 @@ sub hugepages_size {
|
||||
if ($gb_exists && ($size % 1024 == 0)) {
|
||||
return 1024;
|
||||
} elsif (-d "/sys/kernel/mm/hugepages/hugepages-2048kB") {
|
||||
die "memory size must be even to use hugepages\n" if $size % 2 != 0;
|
||||
return 2;
|
||||
}
|
||||
|
||||
die "your system doesn't support hugepages for memory size $size\n"
|
||||
die "your system doesn't support hugepages for memory size $size (1GB hugepages would be supported)\n"
|
||||
if $gb_exists;
|
||||
|
||||
die "your system doesn't support hugepages\n";
|
||||
|
Loading…
Reference in New Issue
Block a user