next up previous contents index
Next: 7.4 Freeing A Non-Contiguous Up: 7. Non-Contiguous Memory Allocation Previous: 7.2 Describing Virtual Memory   Contents   Index

7.3 Allocating A Non-Contiguous Area

The functions vmalloc(), vmalloc_dma() and vmalloc_32() are provided to allocate a memory area that is contiguous in virtual address space. They all take a single parameter size which is rounded up to the nearest page size. They all return a linear address for the new allocated area.



\includegraphics[width=8cm]{graphs/vmalloc.ps}
Figure: Call Graph: vmalloc


As is clear from the call graph shown in Figure 7.3, there is two steps to allocating the area.

The first step with get_vm_area() finds a region large enough to store the request. It searches through a linear linked list of vm_structs and returns a new struct describing the allocated region.

The second step is to allocate the necessary PGD entries with vmalloc_area_pages(), PMD entries with alloc_area_pmd() and PTE entries with alloc_area_pte(). Once allocated there is a special case in the page fault handling code which will allocate the necessary pages as necessary.


Table 7.1: Non-Contiguous Memory Allocation API
\begin{table}\begin{center}
\begin{tabularx}{13.5cm}{\vert X\vert}
\hline
\p...
...I devices require \\ \\
\par
\hline
\end{tabularx}
\end{center} \end{table}



next up previous contents index
Next: 7.4 Freeing A Non-Contiguous Up: 7. Non-Contiguous Memory Allocation Previous: 7.2 Describing Virtual Memory   Contents   Index
Mel 2003-01-14