Is page table updated when an entry is evicted from TLB? and if so, why? what information is updated in the page table? I think updating page table is not needed when the evicted page is clean.
Similarly, is page table updated when a page is cached (brought in) in TLB?
A hardware page table walker (such as defined for x86) can modify accessed and modified indicators as part of loading the page table entry (PTE). Since a PTE can be demand-loaded on a non-write miss, it is possible for the modified indicator to be changed after the PTE has been loaded into the TLB. (It is also possible for PTEs to be prefetched into a TLB, in which case even the accessed indicator might need to be set after the PTE has been inserted into the TLB. Traditional clustered TLB entries, which store more than one PTE per entry with a single tag like subblocking for a regular memory cache, could naturally benefit from prefetching the other page(s) associated with a tag since it involves no extra storage (i.e., no cache pollution effect from such prefetching) and adjacent PTEs are stored within an aligned chunk (for typical multilevel page tables) that would already be fetched from memory.)
TLBs typically use a write-through strategy. This has the advantage of having the cache block in which the PTE resides being recently used. It may also avoid the need to use interprocessor interrupts when clearing accessed or dirty bits. Because TLBs are typically not coherent, using write-back makes software-enforced coherence (when the OS clears accessed or dirty bits) more involved.
Some hardware TLB management architectures do not support hardware setting accessed and dirty indicators. Instead an exception is generated and software handles these special cases. Since setting these indicators is not as rare as changing the address translation or permissions, there can be some advantage to doing such without requiring OS involvement.
(Dirty indicators are used to allow the OS to avoid (unnecessarily) writing back a page that is not dirty when the page is removed from memory. Accessed indicators are used to support a (typically recency-based) page replacement algorithm in the OS.)
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