Home

How do I enable huge pages for XMRig on Linux?

To enable huge pages for XMRig on Linux, reserve a pool of huge pages, make sure XMRig has them enabled, and restart the miner. Then check XMRig’s startup output: huge pages 100% means its memory allocations are successfully using them.

1. Check your memory and page size

Huge pages are larger chunks of memory than Linux normally uses. They reduce memory-management work, which can improve XMRig’s performance when mining Monero with RandomX, Monero’s CPU-focused mining algorithm.

Check your system first:

free -h
grep -i huge /proc/meminfo

On most x86-64 Linux systems, you should see:

Hugepagesize:       2048 kB

That means each standard huge page is 2 MB. The steps below assume this size.

RandomX’s fast mode uses a dataset of about 2,080 MB, plus a 256 MB cache and additional working memory. Leave enough RAM available for Linux and your other programs. A machine with only 4 GB total RAM may struggle, especially with a desktop running.

2. Reserve 2 MB huge pages

For a typical machine using one RandomX dataset, start with:

sudo sysctl -w vm.nr_hugepages=1280

This reserves about 2.5 GB of RAM for huge-page use. It is a practical starting point, not a universal setting: more mining threads or multiple NUMA nodes can require more. NUMA nodes are separate memory areas associated with different groups of CPU cores.

Check what Linux actually reserved:

grep -E 'HugePages_Total|HugePages_Free|Hugepagesize' /proc/meminfo

Before starting XMRig, HugePages_Total should normally show 1280, with those pages largely free.

If Linux reserves fewer pages than requested, memory may be fragmented—split into pieces too small for huge pages. Close memory-heavy programs or apply the persistent setting below and reboot.

Reserved huge-page memory is unavailable to ordinary applications, even when XMRig is not using it.

3. Enable the setting in XMRig

In XMRig’s config.json, make sure the existing cpu section contains:

"cpu": {
    "enabled": true,
    "huge-pages": true
}

Merge these settings into your existing section rather than creating a second cpu entry. Keep any other CPU settings you already use.

Also remove --no-huge-pages if it appears in your launch command.

Start XMRig as your normal user and inspect its output. Look for:

huge pages 100%

The exact surrounding text varies by version. A message saying huge pages are merely “supported” is not proof that XMRig successfully allocated them.

If you see a permissions or locked-memory error, check your distribution’s memory-lock limits. A systemd service may need LimitMEMLOCK=infinity; interactive sessions may need adjusted login limits. Prefer fixing the specific permission problem over permanently running your miner as root.

4. Keep the reservation after a reboot

Create a dedicated configuration file:

echo 'vm.nr_hugepages=1280' | sudo tee /etc/sysctl.d/99-xmrig-hugepages.conf
sudo sysctl --system

To undo this later, stop XMRig, remove that file, and reset the reservation:

sudo rm /etc/sysctl.d/99-xmrig-hugepages.conf
sudo sysctl -w vm.nr_hugepages=0

XMRig also supports optional 1 GB pages on compatible systems. Those require separate setup; they are not necessary to enable standard huge pages.

The bottom line

Reserve the memory, enable "huge-pages": true, and confirm huge pages 100% after restarting XMRig. If allocation falls short, check available memory, permissions, and NUMA layout before increasing the reservation.

All 1,000 questions

MyAiMiner.com

MyAiMiner.com — Monero mining blog. 1,000 questions. Clear answers.

Monero (XMR) Mining BLOG

Hashes0
Blocks accepted0
Blocks rejected0
Runtime00:00:00