how to use the memory allocated in kernel?
Dave Hylands
dhylands at gmail.com
Wed Apr 18 13:47:18 EDT 2012
Hi,
2012/4/18 夏业添 <summerxyt at gmail.com>:
> Hi Dave,
>
> Thanks for reply. My English is not very good, and so I want to ask about a
> term:map. Does map mean that create a relationship between the virtual space
> and physical memory?
In this case yes. The MMU translates virtual addresses to physical
addresses. So when dealing with linux you have a virtual memory space,
and a totally separate physical memory space. The MMU translates (or
maps) virtual addresses to physical addresses.
alloc_vm_space allocates some address space from virtual memory, but
doesn't set up any mapping to physical memory. So the complete process
of allocating memory goes something like this:
1 - Allocate some virtual address space
2 - Allocate some physical pages
3 - Setup the MMU to map your virtual address space to the physical pages.
alloc_vm_pages just does step 1. vmalloc and kmalloc do steps 1, 2, and 3
--
Dave Hylands
Shuswap, BC, Canada
http://www.davehylands.com
More information about the Kernelnewbies
mailing list