Technical guide

CPU TLB Explained: Virtual Addresses, Page Walks, and Translation Caches

Understand what a CPU translation lookaside buffer caches, why virtual-to-physical address translation needs page tables, and how TLB misses and page walks affect performance.

On this page
  1. The TLB caches address translations, not ordinary program data
  2. A TLB hit avoids repeating the full page-table lookup
  3. A TLB miss is not the same thing as a page fault
  4. Page size changes how much address space one translation can cover
  5. Instruction and data translation can be handled separately
  6. TLB pressure depends on the working set and access pattern
  7. Measure translation bottlenecks instead of guessing from TLB size

The TLB caches address translations, not ordinary program data

Modern operating systems normally let software work with virtual addresses while the processor and operating system map those addresses to physical memory. Looking up that mapping through page tables for every memory access would add substantial overhead, so CPUs keep recently useful translations in a translation lookaside buffer, or TLB.

A TLB is therefore different from an L1, L2 or L3 data cache. A data cache holds copies of memory contents. A TLB holds information needed to translate virtual addresses and enforce the attributes associated with those mappings. Both can affect one load at the same time, but they solve different problems.

Keep translation structures separate from ordinary data caches
StructureWhat it keepsWhat a miss means
TLBRecent virtual-to-physical page translations and related mapping informationTranslation must be found through another translation level or a page-table walk
Page tablesOperating-system-managed mapping hierarchy in memoryThey are the authoritative mapping structures, not a small fast cache
L1/L2/L3 cacheCopies of instructions or dataThe requested bytes must be sought farther down the memory hierarchy
DRAMMain-memory contents, including page-table dataAccess can be much slower than an on-core cache hit

A TLB hit avoids repeating the full page-table lookup

When the required translation is already present in the appropriate TLB, the processor can use that cached mapping rather than walking the page-table hierarchy again. Intel documents separate translation caches and paging structures across its processor families, while AMD's software optimization material likewise treats TLB behavior as a distinct part of memory performance.

Exact TLB sizes, levels, associativity and supported page-size entries are microarchitecture-specific. A number published for one Core, Xeon, Ryzen or EPYC generation should not be treated as a permanent x86 specification.

A TLB miss is not the same thing as a page fault

If a translation is absent from the TLB, the processor can perform a page-table walk to find the mapping that already exists in memory. Hardware may also cache intermediate paging information so a walk does not necessarily start from the slowest possible state every time.

A page fault is a different event. It occurs when translation cannot proceed normally under the current mapping and the operating system must handle the condition. Depending on the cause, that can mean establishing a mapping, enforcing access rules, or bringing data into memory. Do not use 'TLB miss' and 'page fault' as interchangeable terms.

Page size changes how much address space one translation can cover

Larger pages let one TLB entry cover more virtual address space, which can reduce translation pressure in workloads with large memory footprints. That is why operating systems and performance-sensitive software sometimes use large or huge pages.

Larger pages are not automatically faster for every application. They can affect memory allocation, fragmentation, mapping granularity and operating-system behavior. The useful question is whether translation overhead is actually limiting the measured workload, not whether a larger page size exists.

Instruction and data translation can be handled separately

Processors commonly distinguish translation used for instruction fetch from translation used for data accesses, and may provide additional shared or second-level translation structures behind the first lookup. This allows the front end and load/store machinery to serve different access patterns efficiently.

The hierarchy is not universal. Vendor optimization manuals for the exact processor generation are the right source when TLB capacities or page-size support matter. Marketing-level CPU specifications rarely provide enough detail for low-level tuning.

TLB pressure depends on the working set and access pattern

A program touching a small number of pages repeatedly can reuse translations effectively. A workload that rapidly touches many pages across a large address range can put more pressure on translation caches, especially when access has little locality.

That makes TLB behavior workload-dependent in the same way cache behavior is workload-dependent, but the two should still be diagnosed separately. A program can have useful data in cache while suffering translation pressure, or have a TLB hit followed by a data-cache miss.

Measure translation bottlenecks instead of guessing from TLB size

A larger TLB can increase translation reach, but its entry count alone is not a CPU performance score. Page-walk caches, page sizes, memory locality, cache hierarchy, memory latency, operating-system policy and the application's allocation pattern all influence the result.

For low-level optimization, use the performance-monitoring documentation and profiler appropriate to the exact CPU. Measure TLB misses, page-walk activity and the real workload before changing page-size policy or memory layout. That preserves the distinction between a plausible architectural bottleneck and one that actually matters to the application.

Sources

Primary and technical sources

Technical details can vary by exact model, firmware, and platform. These are the sources used for the factual claims in this article.

  1. 01 Intel

    Intel 64 and IA-32 Architectures Software Developer's Manual — paging and address translation
  2. 02 Intel

    Intel 64 and IA-32 Architectures Optimization Reference Manual — TLB and memory optimization
  3. 03 AMD

    Software Optimization Guide for the AMD Zen 5 Microarchitecture

Related

Technical guide

16 GB vs 32 GB vs 64 GB RAM for Gaming PCs

Choose 16 GB, 32 GB, or 64 GB of system RAM for a gaming PC by measuring the games and simultaneous workloads you actually run instead of relying on a universal capacity rule.