Totally confused about kmap, highmem, and VM in general

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Hello all,
 This is my first post to the kernelnewbie list, so here we go....

Ok, so I am very much a bottom up learner, so I am trying to understand the kernel from the lowest level up. I am up to the point where I am trying to understand the relationship between virtual memory to the physical memory layout on the machine. What I am totally floundering on is the 3G/1G split and the necessity of highmem. Ok, So I understand that the kernel is placed in the second meg of physical memory and then this is mapped into the top 1G of virtual address space. Where I get confused is everything after that :-) I am failing to understand why all the physical memory is mapped into the kernel space up to the highmem mark and the highmem area is then used to temporarily map additional memory into kernel space. Is this done so that the kernel can then use memory that it controls to hand out to user processes? If so, why does the kernel need these areas of memory mapped into its virtual address space? It seems like the kernel could keep a list of all page frames that are available and then use this to map in page frames for userspace memory without ever having it mapped into kernel memory space.

As an example. Let us start simple, where no highmem is needed, say a machine with 512MB of memory. Accordding to my mental model the kernel would have all of this space linearly mapped in kernel address space. The kernel would then hand out pieces of memory by mapping them into user processe space as requests are made. Is this correct? If so, please explain why the kernel had to have this memory originally mapped into its own address space in order to hand it out to a user process? Then, lets say we have a machine with 1.5GB of memory. The kernel linearly maps 896MB of space into kernel space and the leaves teh remaning 128MB for temporary mappings. When are these temporary mappings done, and for what purpose. Would these temporary mappings take place when user processes require space? Just as above, why does the kernel need to temporarily map this space just to hand it out to user processes?

I've read several tutorials but have yet to pin down exactly why memory is setup as it is. Any help anyone might provide would be greatly appreciated.

Thanks,
Patrick

_________________________________________________________________
Express yourself instantly with MSN Messenger! Download today - it's FREE! http://messenger.msn.click-url.com/go/onm00200471ave/direct/01/


--
Kernelnewbies: Help each other learn about the Linux kernel.
Archive:       http://mail.nl.linux.org/kernelnewbies/
FAQ:           http://kernelnewbies.org/faq/


[Index of Archives]     [Newbies FAQ]     [Linux Kernel Mentors]     [Linux Kernel Development]     [IETF Annouce]     [Git]     [Networking]     [Security]     [Bugtraq]     [Yosemite]     [MIPS Linux]     [ARM Linux]     [Linux RAID]     [Linux SCSI]     [Linux ACPI]
  Powered by Linux