3

My physical memory is 4G and I'm using Android x86 which is 32bit, HIGHMEM4G is enabled. I want to enlarge vmalloc() space as much as possible.

As I tried, if changing to 2G/2G VMsplit and making VMALLOC_RESERVED bigger, vmalloc() space can hopefully reach 1G. But if I want to get bigger vmalloc(), e.g. 2G, is it possible?

Vmalloc() allocates from ZONE_HIGHMEM and ZONE_NORMAL. If I have enough physical memory, ZONE_HIGHMEM is big enough. Can it help to make vmalloc() above 2G? Or vmalloc() is constrained by its virtual space, so if kernel virtual space is 2G in total, vmalloc() absolutely cannot be larger than that?

CindyRabbit
  • 359
  • 2
  • 17

1 Answers1

2

You can approach 2G (on a 2G/2G split), but as you do, your normal zone shrinks.
Most kernel allocations are done from the normal zone, so you'll start seeing a shortage there, leading to severe problems.

Increasing VMALLOC_RESERVE from 1G towards 2G is usually a bad deal. E.g. when moving from 1G to 1.5G, you gain 50% more vmalloc, but your normal zone shrinks by half. And the trade-off gets worse as you approach 2G.

My best advice is to change your code not to use so much vmalloc.
You can use kmalloc and __get_free_pages instead.
Or you can think why to actually need so much kernel memory.

ugoren
  • 16,023
  • 3
  • 35
  • 65