Nowadays, many machines are running with 2-4 gigabytes of RAM, and their owners are discovering a problem: When they run 32-bit GNU/Linux distributions, their extra RAM is not being used. Fortunately, correcting the problem is only a matter of installing or building a kernel with a few specific parameters enabled or disabled.
The problem exists because 32-bit Linux kernels are designed to access only 1GB of RAM by default. The workaround for this limitation is vaguely reminiscent of the virtual memory solution once used by DOS, with a high memory area of virtual memory being constantly mapped to physical addresses. This high memory can be enabled for up to 4GB by one kernel parameter, or up to 64GB on a Pentium Pro or higher processor with another parameter. However, since these parameters have not been needed on most machines until recently, the standard kernels in many distributions have not enabled them.
Increasingly, many distributions are enabling high memory for 4GB. Ubuntu default kernels have been enabling this process at least since version 6.10, and so have Fedora 7's. By contrast, Debian's default 486 kernels do not. Few distros, if any, enable 64GB by default.
To check whether your kernel is configured to use all your RAM, enter the command
free -m. This command gives you the total amount of unused RAM on your system, as well as the size of your swap file, in megabytes. If the total memory is 885, then no high memory is enabled on your system (the rest of the first gigabyte is reserved by the kernel for its own purposes). Similarly, if the result shows over 1 gigabyte but less than 4GB when you know you have more, then the 4GB parameter is enabled, but not the 64GB one. In either case, you will need to add a new kernel to take full advantage of your RAM.
On some distributions, you can add a generic kernel that meets your requirement in a matter of moments. In Debian, for instance, use the
apt-cache search command to locate a recent linux-image package for a kernel for a 686 processor if you want support for up to 4 gigabytes. If you want support for up to 64 gigabytes, look for a kernel that ends with
686-bigmem. These kernels will enable support for 64GB. Unfortunately, a generic kernel for only 4GB does not exist. Similarly, in Ubuntu, look for a recent kernel image whose package name ends in
smp; these kernels are designed for dual core processors, but work on single core processors as well, although sometimes with a small performance hit.
If your distribution does not include a useful generic kernel, or if you want to fine-tune the use of high memory on your system, you need to compile a custom kernel. You should consult your distribution's documentation for the details of where to get the source code and headers and any unique aspects of compiling a kernel for it. However, enabling high memory support involves no more than five parameters in the Firmware Drivers section:
- Make sure that
CONFIG_NOHIGHMEMis not set.
- Set either
yes, using whichever one is appropriate for the RAM in your system. If you have Note that you should use the 4 gigabyte parameter for less than 4 gigabytes of RAM, and the 64 gigabyte parameter for 4 or more gigabytes (4 gigabytes of RAM, remember is actually slightly more than that).
- Optionally, set
yesif you want to log error messages. Since many generic kernels turn this option off, you can probably do without it, especially if you do not delete other kernels from your boot manager's menu, so that you can still start your computer if your newly compiled kernel is unusable.
Compile the rest of the kernel as you choose and install it in your boot manager's menu. Consult the documentation for your boot manager for the details of how to do this.
The next time you start your system, run
free -m again. This time, the results should reflect the actual amount of RAM installed. In the few cases that it does not, add a parameter to your boot manager to specify the amount of memory on the system. For both GRUB and LILO, the parameter is
mem=<amount of RAM>M, placed just after the name of the customized kernel. The amount of RAM should be in megabytes.
Eventually, this problem will disappear as either high memory kernels become the norm in distributions or the transition to 64-bit Linux is finally complete. However, for the next year or so, this solution is likely to remain useful for anyone perplexed by the apparent lack of RAM on their system.