On 11/26/05, Bahadir Balban <bilgehan.balban@xxxxxxxxx> wrote: > It's not clear for me how logical and virtual addresses work. I would > like to know the following: > > 1) For a kernel that has high memory starting at 896MB, and processes > having pages in high memory, when there's data exchange from those > user pages to the kernel or vice versa, does the kernel have to first > map those addresses (i.e. modify page tables), and then access them, > even if the pages are in-memory? > The highmemory (physically above 896MB of RAM) will be accessed by the kernel through mappings because above 896MB memory location is not directly mapped and kept by the kernel. So for always highmemory pages kernel will create mapping to access that page whether its a user space page which is swapped out or already in the physical memory ! > 2) Since a 4GB space is addressable in a 32-bit system, why would the > kernel maintain a 1GB logical space only? LDD3 page 415 says "the > biggest consumer of kernel address space is virtual mappings for > physical memory." Does this mean the page table entries that keep this > mapping consume a lot of kernel space and that's why logical space is > kept low? > Yes, the reason for this is the page-table and virtual mapping of memory requires lot of space and AFAIR the book "Understanding the virtual memory manager by Mel Gorman" Chapter 2 says: (just mentioning to tell how much memory is required to keep the description of memory) "describing 1GiB of memory, approximately 11MiB of kernel memory is required. Thus, with 16GiB, 176MiB of memory is consumed, putting significant pressure on ZONE NORMAL". So the kernel won't keep mappings of the highmemory pages and restricted it-self to only around 1GB of directly mappings. Although there are patches and AFAIK Redhat AS 3/4 (might be other distro too) provides option to change this 1G/3G split to 4G/4G split so kernel will keep mappings almost upto 4GB of physical RAM. And kernel-2.6 also provides option to put the PTEs in highmemory to keep the pressure low on zone_normal. I hope I might be able to clear some of your doubts :) -- Fawad Lateef -- Kernelnewbies: Help each other learn about the Linux kernel. Archive: http://mail.nl.linux.org/kernelnewbies/ FAQ: http://kernelnewbies.org/faq/