Linux is the OS and ARM is the processor referred in this context.
Does the TLB contain both kernel and user space virtual addresses?
Kernel memory starts at 0xc000_0000
and goes to 0xFFFF_FFFF
where the first 3 GB belongs to userspace. Between context switching between processes, the TLB is flushed.
Does the TLB contain both kernel and user space virtual addresses?
Kernel memory (virtual) directly corresponds to physical memory (just offsetting with 0xC000_0000
will give us physical address). Is it necessary to have kernel memory (virtual) in TLB (if you say it is present in TLB)? It should have only the user space address present.
The main reason why we have virtual to physical address translation in modern CPUs is to make a more efficient and better controlled use of memory that lets us:
And page tables make this all possible.
You do want to be able to map and unmap physical memory in the virtual address space in the kernel as well and usually this translation mechanism works in the entire system. Of course, the translation comes at a price as you now need to consult and maintain the page tables and that incurs a performance hit. But all is not lost:
ARMv7-A
's large pages
and sections
) help more since they need fewer TLB entries per unit of the translated memory.global pages
. When you switch between applications and need to flush the current TLB, you can avoid invalidating global pages from the TLB by performing Invalidate TLB entries by ASID match
with the application's ASID
. If you mark the kernel's pages as global, you don't invalidate their translations, and the kernel itself doesn't suffer from unnecessary TLB invalidations.See, for example, "ARM® Architecture Reference Manual ARM®v7-A and ARM®v7-R edition" for specific details related to the ARM Virtual Memory System Architecture
(VMSA), page tables, TLB, etc.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With