What is TLB shootdown?

CachingOperating SystemTlbSmp

Caching Problem Overview


What is a TLB shootdown in SMPs?

I am unable to find much information regarding this concept. Any good example would be very much appreciated.

Caching Solutions


Solution 1 - Caching

A TLB (Translation Lookaside Buffer) is a cache of the translations from virtual memory addresses to physical memory addresses. When a processor changes the virtual-to-physical mapping of an address, it needs to tell the other processors to invalidate that mapping in their caches.

That process is called a "TLB shootdown".

Solution 2 - Caching

A quick example:

  1. You have some memory shared by all of the processors in your system.

  2. One of your processors restricts access to a page of that shared memory.

  3. Now, all of the processors have to flush their TLBs, so that the ones that were allowed to access that page can't do so any more.

The actions of one processor causing the TLBs to be flushed on other processors is what is called a TLB shootdown.

Solution 3 - Caching

I think the question demands a more detailed answer.

page table: a data structure that stores the mapping between virtual memory (software) and physical memory (hardware)

however, the page table can be quite large and traversing the page table (to find the virtual address's corresponding physical address) can be a time consuming process. To make this process faster, a cache called the TLB (Translation Lookaside Buffer) is used, which stores the recently accessed virtual memory addresses.

As can be clearly seen the TLB entries need to be in sync with their respective page table entries at all times. Now the TLBs are a per-core cache ie. every core has its own TLB.

Whenever a page table entry is modified by any of the cores, that particular TLB entry is invalidated in all of the cores. This process is called TLB shootdown.

TLB flushing can be triggered by various virtual memory operations that change the page table entries like page migration, freeing pages etc.

Attributions

All content for this solution is sourced from the original question on Stackoverflow.

The content on this page is licensed under the Attribution-ShareAlike 4.0 International (CC BY-SA 4.0) license.

Content TypeOriginal AuthorOriginal Content on Stackoverflow
QuestionmouseyView Question on Stackoverflow
Solution 1 - CachingGabeView Answer on Stackoverflow
Solution 2 - CachingCarl NorumView Answer on Stackoverflow
Solution 3 - CachingcodaView Answer on Stackoverflow