Does vmalloc() only get memory from ZONE_HIGHMEM on 32bit x86?

linux-kernel, memory-management, vmalloc

Solution

`vmalloc` prefers `ZONE_HIGHMEM`, if it exists, but can fall back to `ZONE_NORMAL`.

However, in a machine with 1GB or more (i.e. any modern machine), `vmalloc` is limited by virtual memory (the `vmalloc` region), not by physical memory. In such a case, the `vmalloc` region is 128MB (unless enlarged by `vmalloc_reserve`), while `ZONE_HIGHMEM` is that plus all memory above 1GB - normally much larger.

What you enlarge is actually the `vmalloc` virtual memory region, and enlarging it lets you `vmalloc` more. This indirectly enlarges `ZONE_HIGHMEM`, but this isn't very impotrant.

Problem

On 32bit x86 platform, if vmalloc() can allocate memory from either ZONE_NORMAL or ZONE_HIGHMEM, does it mean that even if I enlarge ZONE_HIGHMEM, the actual total range that vmalloc() can use is unchanged? I did a test to enlarge ZONE_HIGHMEM, the one time allocation of vmalloc() can be much bigger than before. So does it mean that vmalloc() actually allocate memory from ZONE_HIGHMEM only?

Original source