Re: Running out of vmalloc space

Stephen C. Tweedie
2001-05-18T11:53:54Z

Hi,

On Thu, May 17, 2001 at 04:48:38PM -0600, David Pinedo wrote:

> Unfortunately, yes. It has to be in the kernel's virtual address space,
> because the kernel graphics driver initiates DMAs to and from the
> graphics board, which can only be done from the kernel using locked down
> physical memory.

Why does it have to be virtually contiguous? If you are using vmalloc
then you are necessarily using physically-discontiguous space. If you
are doing DMA on that space then the kernel isn't accessing it
virtually at all, except perhaps to populate it, which can be done
trivially page by page without having the space virtually contiguous.

It is often a lot easier on the kernel programmer if the addresses
are virtually contiguous, but it is very rarely necessary. It is
trivial to create an "offset_to_virt" helper function which translates
an offset within one of your pci regions to a virtual kernel address
by indexing a physical page location array which contains the list of
allocated pages. The *only* thing which is measurably more difficult
without vmalloc is crossing page boundaries.

Cheers,
Stephen