On 10/17/05, Roy Smith <misterdabolina@xxxxxxxxx> wrote: > Hi all, > > I want to refine a previous question of mine > (and thank everybody who helped me!) > about the virtual memory of the kenel itself. > > Where does the kernel keeps its own page tables ? > are they all swapped-in all the time ? The memory in the Kernel/Kernel Module will never be swapped-out !!!! The kernel keeps the Virtual Address range from 3G (PAGE_OFFSET) to 4G for it-self, in which it creates 1 to 1 mapping of physical memory like 3G of Virtual Address points to 0 Physical Address and so on .... till the 896MB Physical RAM or less than 896MB MAX avaialble RAM in the System ... and for (3G + 896MB) to 4G is called as VMALLOC_RESERVE, which is used in tempoarary mappings of the physical memory above 896MB (HighMemory) .... and let say if system has 256MB RAM then 3G to (3G + 256MB) Virtual Address will have direct mappings and remaining 4G - (3G + 256MB) Virtual Address range is VMALLOC_RESERVE ..... So the page table exists for 0 to 896MB of Physical RAM and for accessing more than 896MB it temporary creates mappings with-in its virtual address range already reserved for Highmemory mappings ..... > isn't it a lot of mostly-unused memory ? > No its not unused memory because in modern operating systems and in Linux too the approach is not keep free memory there ... rather use all memory for caching to speed-up the things and when some one needs memory it simply fullfills the requirement from the memory already in use for caching .... Although page structures and page tables uses and required memory but that memory we can't avoid as those have to be kept some where in memory for fast accessing .... and 0 to 896MB only Physical Memory mapping/page tables are created to use the memory as much less as possible for them .... because if the system has 32GB of RAM and kernel create all the page-tables then u can think that more than 32-times of memory required for keeping page-tables as compare to keep them only for less than 1GB RAM .... (I might not be so clear to explain and might be missing something, so others plzz do make them correct) -- Fawad Lateef -- Kernelnewbies: Help each other learn about the Linux kernel. Archive: http://mail.nl.linux.org/kernelnewbies/ FAQ: http://kernelnewbies.org/faq/