Re: kernel address space question

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

 



On 9/7/05, NAHieu <nahieu@xxxxxxxxx> wrote:
> Hi,
> 
> I follow the address space thread on the list, and have a question.
> 
> - Kernel space maps the physical memory to virtual address from 3G to
> 4G (I am talking about vanilla kernel).  So if in the *kernel
> context*, I access to the virtual address 3G+128MB, then actually I
> will access to the physical memory at 128MB.
> 
> The question is: in *kernel context*, do I need the page table? 

Yes a page table is needed even in kernel context.

> As
> above, I suppose that since I can work out the physical memory address
> directly from the virtual address (by subtracting the virtual address
> with PAGE_OFFSET), so I do not need the page table.

You dont, but the MMU on the x86 processor needs it.

> 
> So the conclusion is: (in *vanilla kernel*) page tables are only for
> userspace processes, and kernel space doesnt need page tables at all.

One feature of page tables is that each page table entry has an
associated Global 'G' flag set on it. when this is done, those entries
are not flushed even when the CR3 is loaded. I think the kernel can be
put up using those flags. Also the kernel code is placed in two 4MB
pages on x86 which supports PSE (Page Size Extensions). This reduces
TLB misses of kernel code as well as reduces contention for 4K page
TLB (since 4MB has a separate TLB).

> 
> Is that correct?
> 
> 
> Many thanks,
> NAH
> 
> --
> Kernelnewbies: Help each other learn about the Linux kernel.
> Archive:       http://mail.nl.linux.org/kernelnewbies/
> FAQ:           http://kernelnewbies.org/faq/
> 
> 


-- 
The difference between Theory and Practice is more so in Practice than
in Theory.

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