Google Groups no longer supports new Usenet posts or subscriptions. Historical content remains viewable.
Dismiss

flush tlb on x86

66 views
Skip to first unread message

Sigh

unread,
Dec 8, 2009, 1:26:12 AM12/8/09
to
1) x86 reloads cr3 to flush/invalidate tlb.
2). every time modifying the page table entry of kernel address space,
flush_tlb_kernel_range() or flush_tlb_all() should be called except
the page table entry is 0 before modification. Actually
flush_tlb_kernel_range() just calls flush_tlb_all() on x86.
flush_tlb_all() will send interrupt to all CPUs to execute do_flush_tlb_all()
which will invalidate all tlb.
3). every time modifying the page table entry of user address space, f
lush_tlb_mm(), flush_tlb_page() or flush_tlb() should be called except
the page table entry is 0 before modification. Actually flush_tlb_mm(
), flush_tlb_page() and flush_tlb() do the almost the same things: you
can think flush_tlb() just calls flush_tlb_mm(current->mm) and flush_
tlb_page() just calls flush_tlb_mm(vma->vm_mm). flush_tlb_mm() will se
nd tlb flushing interrupt (smp_invalidate_interrupt) to all CPUs on wh
ich the current processes use the same active_mm with the mm argument
of flush_tlb_mm() and the CPUs that receive the interrupt will flush t
lb.
4). There is a lazy TLB mode to reduce the number of flushing tlb. Whe
n a CPU (assume CPU 0) switches to a kernel thread (assume named "A"),
the kernel thread will use the active_mm of previous thread (assume n
ame "B") as its active_mm and the cr3 will not be reloaded. The CPU 0
now enters the lazy tlb mode. If there is no tlb flushing interrupt re
ceived on CPU 0 during execute thread A and CPU0 will switch to execut
e thread B again, the cr3 will not be reloaded and the CPU 0 will leav
e the lazy tlb mode. If there is a tlb flushing interrupt received on
CPU 0 during execute thread A, the CPU 0 finds that it is in lazy tlb
mode, it will clear the related flag to tell system that do not send m
ore tlb flushing interrupt to CPU 0 (kernel thread A will not use any
user space address). Then if CPU0 will switch to execute thread B agai
n, the cr3 will be reloaded due to the related flag has been cleared i
n smp_invalidate_interrupt() (some page table entry for process B has
been modified). The CPU 0 will leave the lazy tlb mode now.

--

[m [1;33m锟斤拷 锟斤拷源:锟斤拷水木锟斤拷锟斤拷 newsmth.net锟斤拷[FROM: 72.163.255.*] [m

>/dev/null

unread,
Dec 8, 2009, 7:29:33 AM12/8/09
to
要说啥锟截o拷
锟斤拷 锟斤拷 ikaikai (Sigh) 锟侥达拷锟斤拷锟斤拷锟结到: 锟斤拷
: 1) x86 reloads cr3 to flush/invalidate tlb.

: 2). every time modifying the page table entry of kernel address space,
: flush_tlb_kernel_range() or flush_tlb_all() should be called except
: ...................

--

[m [33m锟斤拷 锟斤拷源:锟斤拷水木锟斤拷锟斤拷 http://newsmth.net锟斤拷[FROM: 119.42.238.*] [m

0 new messages