RE: Running out of vmalloc space

Hua Ji
2001-05-17T18:51:49Z

>What are the implications of making such a change? Will it work when
>there is less or more memory in the system? Should this be a
>configurable kernel parameter?

My 2 cents:

By default, linux kernel space starts from PAGE_OFFSET, which is 0xC0000000.
In other words,
All the kernel can only have 1G memory left for usage, if/when under a 32bit
CPU.

Even with the 1G left, the cake left for vmalloc is much less than the 1G.
Kernel
will map the PAGE_OFFSET~PAGE_OFFSET+physical_memory for kmalloc usage. The
real start point for
vmalloc is high_memory + 8M(this is a hole).

Hence, we can understand that the virtual address left for vmalloc is really
small.

For example, if your machine has a physical memory of 256M. And then your
vmalloc can only manage
(1G-256M-8M) space.

If we go through the get_vma_area that is called by vmalloc(), we will find
this:

------------------------------------------
addr = VMALLOC_START;
.....

if (addr > VMALLOC_END-size) {
kfree(area);
return NULL;
}
------------------------------------------

Therefore, it is very possible that your driver codes can't find **big
enough hole** in the vmlist, which
is a global linked list for maintaining all the vm_struct data structures.

For enlarging the managed memory, you can try this:

* change the PAGE_OFFSET to 0x80000000(for example) from 0xC000000. Then you
will have 1G extra memory managable:-). However, the side effect is: your
user level tasks can only range from 0x0 to 0x8000000(2G).

Wish helpful,

Mike