Re: Running out of vmalloc space

David Pinedo
2001-05-22T23:16:49Z

I followed up on the suggestion of several folks to not map the graphics
board into kernel vm space. While investigating how to do that, I
discovered that the frame buffer space did not need to be mapped -- it
was already being mapped with the control space. So instead of needing
(32M+16M)*2=96M of vmalloc space, I only need 32M*2=64M. That change
seemed easier than figuring out how not to map the board into kernel vm
space, so...

Given that VMALLOC_RESERVE is 128M, and there was about 92M left when my
graphics driver was being initialized, I thought I should have plenty of
room to map the two graphics boards. It worked -- the first time. If I
exitted the X server and restarted it, I would get the same errors from
the X server as when it was not able to map one of the devices.

I verified that the kernel vm space was being freed when the X server is
shut down, so that wasn't the problem. On further investigation, I found
that after the X server initialized the graphics boards, somebody else
was allocating a 24k chunk of vm space, immiediately after the two
chunks allocated by the graphics driver. When the graphics driver tried
to re-allocate those two chunks the next time the X server was started,
it was able to get the first, but not the second chunk. I looked at the
get_vm_area code in vmalloc.c, I found that it will not allow a vm space
to be allocated from a free space that is exactly the size of the space
being allocated. I think the statement:

if (size + addr < (unsigned long) tmp->addr)
break;

should be:

if (size + addr <= (unsigned long) tmp->addr)
break;

Making this change seems to fix my problem. :-)

David Pinedo