Библиотека сайта rus-linux.net
The book is available and called simply "Understanding The Linux Virtual Memory Manager". There is a lot of additional material in the book that is not available here, including details on later 2.4 kernels, introductions to 2.6, a whole new chapter on the shared memory filesystem, coverage of TLB management, a lot more code commentary, countless other additions and clarifications and a CD with lots of cool stuff on it. This material (although now dated and lacking in comparison to the book) will remain available although I obviously encourge you to buy the book from your favourite book store :-) . As the book is under the Bruce Perens Open Book Series, it will be available 90 days after appearing on the book shelves which means it is not available right now. When it is available, it will be downloadable from http://www.phptr.com/perens so check there for more information.
To be fully clear, this webpage is not the actual book.
Next: 8.3 Freeing A Non-Contiguous Up: 8. Non-Contiguous Memory Allocation Previous: 8.1 Describing Virtual Memory   Contents   Index
8.2 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 next page alignment. They all
return a linear address for the new allocated area.
As is clear from the call graph shown in Figure 8.2, there are 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_struct
s 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()
before finally allocating
the page with alloc_page()
.
The page table updated by vmalloc()
is not the current process but
the master page table referenced by init_mm
pgd
. This
means that a process accessing the vmalloc area will cause a page fault
exception as its page tables are not pointing to the correct area. There is
a special case in the page fault handling code which knows that the fault
occured in the vmalloc area and updates the current process page tables
using information from the master page table.
Next: 8.3 Freeing A Non-Contiguous Up: 8. Non-Contiguous Memory Allocation Previous: 8.1 Describing Virtual Memory   Contents   Index Mel 2004-02-15