RE: memory used by kernel?

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

 



  Jon, correct me if I am wrong.  

  Let us consider the iomem display:

  $ cat /proc/iomem
  . . .
  00100000-1fecffff : System RAM
  00100000-0028dadf : Kernel code
  0028dae0-00324f63 : Kernel data
  . . .

  This means, the system has 512MB RAM and kernel is taking around
  2MB (code+data) - very less. But, I don't think this iomem
  shows the total memory used by kernel. That is, after a kmalloc,
  a new page might be created and mapped into kernel page table.
  Such dynamically created kernel memory is not shown in this
  iomem stats. Am I correct?

-> The kernel mostly uses virtual memory for its view of the world, and
-> the 3GB/1GB split comes from the desire to use a single set of page
-> tables for a process both when in userspace and in kernelspace. This
-> speeds up the functioning of the kernel, but means however that a
-> bodge is necessary - the process has the first 3GB to itself, but
-> memory above that is the kernel addressspace, which is used when in
-> kernel mode. There could here be a separate set of page tables (there
-> are but they essentially are already bolted on to the user process')
-> but that would be extra overhead and work for little gain. 

  I read that, linux kernel memory is not pageable. That means,
  there is no swap in/out of kernel memory. What ever memory 
  allocated by kernel always reside in memory.

  If my understanding is correct, kernel memory is also divided 
  and maintained as page tables, even though the mapping of kernel 
  address space from virtual to physical is one-to-one (using 
  __pa and __va macros).

  My questions are:

  1. why do we need page tables for kernel memory from PAGE_OFFSET 
     to HIGHMEM, if the conversion is direct. Isn't it just sufficient 
     to maintain kernel page tables for HIGHMEM, instead of NORMAL.

  2. Let us consider there is some advantage of maintaining kernel
     page table (along with every process page table), then, kernel
     page table also mush reside in memory always (even if the linux 
     kernel is not pageable). If the kernel page table is in memory
     always, isn't it trivial to implement kernel memory as pageable.
     What is the rational behind the kernel being not pageable?

  3. Does each and every kernel address mapped in every process
     virtual memory (some where in between 3GB to 4GB). Even
     when kernel does a kmalloc from interrupt context?

  I read enough material on this subject but couldn't get my doubts
  cleared, FYI:
  http://www.skynet.ie/~mel/projects/vm/
  http://home.earthlink.net/~jknapka/linux-mm/vmnotes.html
  http://kerneltrap.org/node/view/2450

Thanks,
Venkata.

--
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