Igalia Engineer, Tvrtko Ursulin has recently submitted a patch to the Linux kernel adding a NUMA (Non-Uniform Memory Access) emulation implementation for arm64 platforms that can boost the performance of 64-bit Arm targets by “splitting the physical RAM into chunks and utilizing an allocation policy to better utilize parallelism in physical memory chip organization”.
The NUMA emulation implementation was tested on a Raspberry Pi 5 SBC and the Geekbench 6 single-core score improved by 6%, while the multi-core score boosted by 18% after splitting into four emulated NUMA nodes. In other words, that’s like having a Broadcom BCM2712 CPU overclocked from 2.4 GHz up to 2.83 GHz.
The patch is actually quite short, around 100 lines, and the main C code file is about 60 lines long (stripped from SPDX header):
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 |
#include <linux/memblock.h> #include "numa_emulation.h" static unsigned int emu_nodes; int __init numa_emu_cmdline(char *str) { int ret; ret = kstrtouint(str, 10, &emu_nodes); if (ret) return ret; if (emu_nodes > MAX_NUMNODES) { pr_notice("numa=fake=%u too large, reducing to %u\n", emu_nodes, MAX_NUMNODES); emu_nodes = MAX_NUMNODES; } return 0; } int __init numa_emu_init(void) { phys_addr_t start, end; unsigned long size; unsigned int i; int ret; if (!emu_nodes) return -EINVAL; start = memblock_start_of_DRAM(); end = memblock_end_of_DRAM() - 1; size = DIV_ROUND_DOWN_ULL(end - start + 1, emu_nodes); size = PAGE_ALIGN_DOWN(size); for (i = 0; i < emu_nodes; i++) { u64 s, e; s = start + i * size; e = s + size - 1; if (i == (emu_nodes - 1) && e != end) e = end; pr_info("Faking a node at [mem %pap-%pap]\n", &s, &e); ret = numa_add_memblk(i, s, e + 1); if (ret) { pr_err("Failed to add fake NUMA node %d!\n", i); break; } } return ret; } |
Code can be enabled using the new NUMA_EMULATION Kconfig option and then at runtime using the existing (shared with other platforms) numa=fake=<N> kernel boot argument. Users would also need to set up an interleaving allocation policy using a test program with:
1 |
numactl --interleave=all COMMAND |
So that would be for one specific program, but Tvrtko also explains a system-wide policy could be configured via systemd.
Although there’s no guarantee benchmark improvements transfer to overall system improvement, that’s great to have a “free” performance boost. The patch will still have to go through some iterations, and it’s still unclear whether the patch will be accepted, as Greg replied:
Why not just properly describe the numa topology in your bootloader or device tree and not need any such “fake” stuff at all?
Also, you are now asking me to maintain these new files, not something I’m comfortable doing at all sorry.
Time will tell.
Via Tom’s Hardware and Phoronix

Jean-Luc started CNX Software in 2010 as a part-time endeavor, before quitting his job as a software engineering manager, and starting to write daily news, and reviews full time later in 2011.
Support CNX Software! Donate via cryptocurrencies, become a Patron on Patreon, or purchase goods on Amazon or Aliexpress