Hugepages¶
Roles with access
Only administrators have access to this feature. The hugepages pool is reserved on the host and requires root access to the hypervisor server.
Hugepages are memory pages much larger than the default 4 KiB pages. IsardVDI uses them to accelerate desktop startup, especially for desktops with an assigned GPU (MIG or vGPU profiles).
Why IsardVDI uses them¶
When a virtual machine receives a GPU, the host machine must map all the guest's RAM to the IOMMU before starting it. With 4 KiB pages, this involves hundreds of thousands of mapping entries. With 1 GiB pages, there are only a few.
| Page size | Pages per GiB of RAM | Availability |
|---|---|---|
| 4 KiB (default) | 262,144 | always |
| 2 MiB | 512 | always |
| 1 GiB | 1 | requires the pdpe1gb CPU flag |
In addition to reducing VFIO/IOMMU mapping time, hugepages are reserved in advance and cannot be swapped to disk. This provides more predictable latency.
1 GiB pages are only reserved at boot
They require contiguous blocks of physical memory. The pool is configured via kernel parameters, and the server must be restarted for the changes to take effect.
Host configuration¶
The pool is reserved using the sysadm/hugepages/setup-hugepages.sh script from the IsardVDI repository. It is the only tool that configures hugepages: the web panel only displays them.
Available options¶
| Command | Effect |
|---|---|
sudo ./setup-hugepages.sh |
Shows the current status: CPU support, reserved pool, mount point, and GRUB configuration. It does not modify anything. |
sudo ./setup-hugepages.sh --apply N |
Reserves N 1 GiB pages. Updates GRUB and requests a reboot. |
sudo ./setup-hugepages.sh --apply N --size 2M |
Same, but with 2 MiB pages (alternative for CPUs without pdpe1gb). |
sudo ./setup-hugepages.sh --remove |
Removes the hugepages configuration from GRUB. Requires a reboot. |
sudo ./setup-hugepages.sh --help |
Shows the help. |
The script writes to GRUB_CMDLINE_LINUX at /etc/default/grub:
Before modifying it, it creates a timestamped backup, cleans up any previous hugepages parameters, and runs update-grub.
Sizing the pool¶
The number of pages is manual: there is no auto-detection.
- General rule:
number of GPU desktops × RAM per desktop (GiB) = N. For example, 10 desktops of 8 GiB →--apply 80. - The status mode suggests a maximum of total RAM − 16 GiB, to leave space for the host operating system and non-GPU desktops.
- Each 1 GiB page is 1 GiB of dedicated RAM: it is no longer available for the rest of the system, even if not used.
Mount point¶
The hypervisor container looks at /dev/hugepages. It can be changed with the HUGEPAGES_PATH variable in isardvdi.cfg:
On startup, the container checks that it is a hugetlbfs mount and, if so, adds hugetlbfs_mount = "/dev/hugepages" to /etc/libvirt/qemu.conf. Without this line, libvirt rejects any domain that uses hugepages.
How IsardVDI decides whether a desktop will use huge pages¶
The decision is automatic and per desktop, and is made at startup. There is no option in the desktop or template form to enable them.
flowchart TD
A[Desktop start] --> B{Pool mounted<br/>on the hypervisor?}
B -- No --> Z[4 KiB pages]
B -- Yes --> C{Does the desktop<br/>have a GPU?}
C -- Yes --> D{Free hugepages<br/>≥ VM RAM?}
D -- Yes --> E{Memory Backing section<br/>protected?}
D -- No --> Z
C -- No --> F{Free RAM − VM RAM<br/>< min_free_mem_gb?}
F -- Yes --> D
F -- No --> Z
E -- No --> G[Injects memoryBacking<br/>with hugepages]
E -- Yes --> Z
In summary:
- Desktops with GPU: huge pages are the default optimization. They are applied as long as the pool is mounted and there are enough free pages.
- Desktops without GPU: they are only used as a fallback when the hypervisor's regular RAM drops below the minimum free memory threshold. This threshold is configured with
HYPER_FREEMEM(in GiB) inisardvdi.cfgand cannot be edited from the web panel; with the default value0, desktops without GPU only use huge pages when the hypervisor's free regular RAM can no longer fit them. - If there are not enough free pages, the desktop will still start with 4 KiB pages and a warning will be written to the engine log.
- If the pool is exhausted between the check and the actual start (for example, with several simultaneous starts), the engine retries without huge pages instead of leaving the desktop in state
Failed.
When applied, the engine injects this block into the domain XML:
<memoryBacking>
<hugepages>
<page size='1' unit='G'/>
</hugepages>
<allocation mode='immediate' threads='8'/>
<locked/>
</memoryBacking>
Monitoring from the administration panel¶
- Go to Administration → Infrastructure → Hypervisors.
- The RAM bar for each online hypervisor displays a hugepages indicator when any are reserved:
The indicator has the format (HP:used/totalGB):
- used: pool memory occupied by started desktops.
- total: size of the pool reserved on the host.
If there are no hugepages, nothing is displayed
The indicator only appears when the hypervisor reports a pool greater than zero. On a hypervisor without configured hugepages, the RAM bar is displayed in the same way, but without the (HP: …) part.
When there are multiple online hypervisors, the summary panel at the top (Pool Totals) adds an HP column with the aggregated total for the entire cluster. With a single hypervisor, this panel remains hidden.
Excluding a specific desktop¶
Although the decision is automatic, the administrator can prevent a desktop from using large pages by protecting the corresponding section in its XML.
From the desktop list, open the desktop's XML editor and locate the Memory Backing section, within the Compute group:
By marking it as protected, the engine stops injecting <memoryBacking> at boot time, and the content written there becomes authoritative:
The lock is not saved from the interface
In the current version, the section lock changes to Locked on the screen, but is not saved: the XML content is stored, but the protection flag is lost, and the engine continues to rewrite the section at boot time.
The cause is a field name mismatch between the web application and the API: the interface sends xml_protected_sections, while the API expects protected_sections, so the field is silently discarded, and the save operation continues to return 200.
Until this issue is resolved, protection can only be applied by calling the API directly with the correct field name.
RAW mode
If the desktop is in RAW XML mode, all automatic engine injections (large pages, NUMA pinning, and I/O threads) are disabled, not just this one.
This protection is useful for manually setting a different page size, or for excluding a specific desktop from a test, without modifying the host configuration.
Verification¶
Once the server has been restarted, check that the pool exists:
# Parameters applied to the kernel
cat /proc/cmdline | tr ' ' '\n' | grep -i huge
# Pool status
grep -i huge /proc/meminfo
# HugePages_Total: 80
# HugePages_Free: 80
# Hugepagesize: 1048576 kB
# The mount point is hugetlbfs
mount | grep hugetlbfs
And that a started desktop actually uses them:
It must show the <memoryBacking> block with the expected page size. The free page counter must decrease when the desktop starts and increase when it stops:
Deactivation¶
Temporarily, without restarting¶
Empty the pool at runtime. This only works if no desktop is using it:
With the pool at zero, the engine stops injecting <memoryBacking> and new desktops start with 4 KiB pages. Those already running keep their configuration until they are restarted.
Restored on next restart
The parameter hugepages=N remains in GRUB, so the pool is reserved again when the server restarts.
Permanently¶
Limitations and common issues¶
Desktops with less than 1 GiB of RAM. On a host with 1 GiB pages, QEMU rejects any domain with less memory than the page size:
Always assign an exact multiple of 1 GiB. This affects any small machine, with or without a GPU.
The pool cannot be freed. If nr_hugepages does not drop to zero, some domains still have it reserved. Stop them before trying again.
"Non-existent" memory. The pool's RAM does not appear as available to the system, even if no desktop is using it: it is reserved by definition. If N has been sized incorrectly, reduce it and restart.


