KVA_PAGES is a compile time kernel option on the i386 architecture.

The default value is 256 (512 for PAE enabled kernels) and it is defined in i386/include/pmap.h. This option directly influences the size of the kernel virtual address space and how much is left for userland processes. A value of 256 (512 for PAE) divides the virtual address space (which has a size of 4GB on i386) into a chunk of 3GB for userspace programs (lower part) and 1GB for the kernel (upper part). Setting it to 512 (1024 for PAE) divides the virtual address space into two 2GB parts. KVA_PAGES has to be a multiple of 4 (8 for PAE). The most common reason for tuning KVA_PAGES is to allocate more memory for the kernel when using the ZFS.

Setting KVA_PAGES to something different than the default may break some programs. Especially wine seems to be affected. It is also possible to create an unbootable kernel by reducing KVA_PAGES enough.

KVA_PAGES (last edited 2020-10-15T00:36:14+0000 by SashaVigole)