Reconsidering x32 — again
The 64-bit x86 CPU architecture brought a number of long-desired features, including more registers, better system-call support and, of course, the ability to support larger virtual address spaces. There is a cost to that last feature, though; the size of addresses (and, thus, pointers) doubled from four to eight bytes. That change inevitably increases the amount of memory used by a program and, importantly, the amount of cache required to hold the pointed-to values. Since cache utilization has a huge effect on the performance of many programs, that extra cache footprint hurts.
The idea behind x32 is to provide all of the x86-64 features, but to use 32-bit addresses and data types, bringing the memory and cache footprint back down. Supporting this ABI required work in the kernel, but also at the toolchain level; the result was expected to be the fastest x86 ABI available. Evidence for that speedup was scarce when x32 kernel support was under development in 2011 but, by 2013, some realistic benchmark results were being posted, and some distributors were beginning to work on support.
Despite its apparent advantages, though, x32 never really took off. One can speculate on the reasons why that happened. Perhaps processor speed and cache sizes increased enough to mitigate the cost of 64-bit pointers. Most applications are not so performance sensitive that it is worth the trouble to support another ABI. The applications that broke with 64-bit pointers were quickly fixed. Memory use has grown to the point that it is challenging to shoehorn even a basic "hello world" app into the 2-3GB of virtual address space that 32-bit pointers afford. Other possible explanations surely exist as well.
Also noteworthy is that many distributions never supported this ABI, making it unavailable to a lot of users. Having to build one's own kernel (and possibly toolchain as well) can be a strong impediment to experimenting with an alternative ABI. Debian and Gentoo did add x32 support; Ubuntu also supported x32, but dropped it in 2023, citing a lack of demand and concerns about the additional attack surface created by enabling that ABI (which has had vulnerabilities in the past). Modern Debian kernels retain x32 support, but it is only enabled when the syscall.x32=y boot option is provided.
In 2018, Andy Lutomirski proposed
removing support for the x32 architecture, saying that it was largely
unused and the necessary system-call interface added a lot of complexity to
the kernel. An extensive discussion ensued. Linus Torvalds remarked
that the main use of x32 was "extreme benchmarking
", and said he
would not be opposed to removing support if there were no complaints.
But, naturally, there were complaints. Thorsten Glaser was reluctant to lose his x32 Debian desktop. Richard Purdie pointed out that the Yocto Project supported x32 and occasionally got bug reports. Rich Felker said that GCC performance benefits from an x32 build and that the ABI is useful for catching portability problems. Others expressed an interest in preserving the ABI as well. In the end, while the groundswell of support for x32 was not huge (and John Paul Adrian Glaubitz, the maintainer of the Debian x32 port, even stated his non-opposition to the change), the idea of removing it was dropped, and that support remains in current kernels.
On May 23, though, Sebastian Andrzej Siewior reopened the
discussion around removing it. There is, he said, "practically no
real use for x32
" and that the performance benefits it offers are not
compelling enough to cause users to adopt it. He suggested removing the
configuration symbol that must be set to build x32 support into the kernel.
If enough time passes without complaint, then all of the code implementing
that support could be removed as well.
The reaction this time around has been more subdued — so far, at least.
H. Peter Anvin did not oppose phasing out the x32 ABI, noting
that it "happened too late to actually be able to become useful
".
He mostly took issue with Siewior's suggestion that the x32-specific
system-call numbers could be reused, which is not a huge concern in any
case, since system-call numbers are not in short supply. The x32 ABI
still does not appear to be entirely unused, though. Sam James said that Gentoo still has
some x32 users and Neal Gompa pointed out that PLD
Linux has an actively supported port: "So it isn't broadly used indeed,
but it's used enough that it's probably worth being slightly more careful
about deciding to remove it
". Glaubitz said
that the Debian port is still maintained; "even Rust works there
".
Those comments notwithstanding, the response to Siewior's proposal has
seemingly been one of overwhelming indifference. The people most aware of
x32 support in the kernel are the ones who have to maintain it, and there
has been a distinct lack of developers offering to help with that task.
The returns from maintaining this ABI would appear to be diminishing. Even
so, kernel developers are generally reluctant to remove support for
features that are actively in use. So, even though almost nobody wants it
(and many actively want it gone), x32 support may yet live on in the
kernel.
| Index entries for this article | |
|---|---|
| Kernel | x32 |
