concept Servers & hardware
Huge pages and TLB address translation
A larger page lets each TLB entry cover more bytes, so the same address range may need fewer translations. Installed RAM stays the same, and a partly used last page can leave more space unused.
What it means
A translation lookaside buffer (TLB) caches address translations. Linux kernel: HugeTLB Pages. If each entry translates one page, a larger page lets the same entries cover more bytes: the extra coverage comes from each translation, not from adding RAM.
Assume a contiguous range starting at byte 0, aligned to the chosen page size, with all TLB entries available for that size. Two calculations answer different questions:
- Translations needed: Divide the range in bytes by the page size in bytes and round up. Even one byte on the next page needs another translation.
- TLB reach: Multiply the available entry count by the page size in bytes. This is how many bytes the entries could cover at once, not how many bytes the application uses.
Try it
Keep Aligned working range at 8388608 bytes (8 MiB) and Available TLB entries at 64. Compare the default Page size (KiB) of 4 with Use 2 MiB pages, which sets it to 2048. These are synthetic inputs, not measurements of your hardware.
Huge pages and TLB address translation
Change page size, working-set bytes and a bounded TLB-entry count; inspect page mappings, translation coverage and fragmentation tradeoffs.
Synthetic inputs only. This is not a measurement of your hardware or service.
2048 translations are needed; 64 entries cover 262144 bytes under the declared one-size model.
Address coverage, not added RAM
- Translations needed
- 2048
- Coverage of available entries
- 262144 bytes
- All mappings fit the stipulated entry count
- No
- Whole-page allocation
- 8388608 bytes
- Unused tail of last page
- 0 bytes
- First mapped page
- 0
- Last mapped page
- 2047
Evaluated evidence
- Aligned working range (bytes)
- 8388608
- Available TLB entries
- 64
- Effective page size (bytes)
- 4096
Aligned, contiguous range; all TLB entries available for one page size. Real TLB levels, associativity, residency, workload misses and CPU speed are not modeled. RAM capacity is unchanged.
About this model
Every input is local synthetic evidence. Numbers stay as raw text until this model validates them. The shown evaluated values come from the same result as the explanation.
Presets replace the entire scenario. Reset restores all starting fields, scenario selection and model state; it does not change the open or closed state of this help or article FAQ.
No external request, device command, stored-input history or measurement is performed.
- 4 KiB pages: Dividing 8,388,608 by 4,096 gives 2,048 pages, numbered 0 through 2,047. The 64 entries have a reach of 64 × 4 KiB = 256 KiB. The whole 8 MiB range is mapped, but its 2,048 translations cannot all fit in 64 entries at once.
- 2 MiB pages: The same 8 MiB spans just four pages, numbered 0 through 3. All four translations fit. The 64 entries have a reach of 64 × 2 MiB = 128 MiB, but only four entries are needed for this range. The whole-page allocation is still 8 MiB, not 128 MiB.
Now keep the 2 MiB pages and set Aligned working range to 2097153 bytes: 2 MiB plus one byte. That last byte requires a second page. Whole-page allocation is page count times page size, so the model reserves 4 MiB (4,194,304 bytes). Subtract the requested 2,097,153 bytes: 2,097,151 bytes in the last page are unused by this range.
Choose Inspect the evidence boundary to leave the page size unknown. With 8 MiB and 64 entries but no page size, neither the translation count nor the reach is established. Invalid input is different: enter the range and entry count as decimal digits only, from 1 to 1,073,741,824 bytes and 1 to 4,096 entries, respectively. An entry count of 64.000000000000000001 is rejected as written, not rounded to 64; no result is computed.
Reset returns the exercise to its starting state, including the default inputs, with no prior errors, history or comparison.
In practice
Supported page sizes depend on the architecture. Linux provides HugeTLB for explicit large pages and documents Transparent Hugepage support as a distinct mechanism. This exercise configures neither.
A fit is a capacity check, not a miss count. The model does not track which translations are already cached, which entries they can occupy at each TLB level, what competes for those entries or the order in which the application touches its pages. It cannot predict a miss rate or a speedup.
For your application, ask how many pages its accesses span at each size and how much of the last page goes unused. Use measurements from that access pattern before making a performance claim. Larger pages change translation coverage and allocation granularity, not the amount of installed memory.
Frequently asked questions
Editorial questions based on the listed sources and explicitly labeled local examples.
Does a larger page add RAM?
No. Changing the mapping granularity does not increase the amount of installed RAM; this calculation changes pages and translation coverage.
Is TLB reach a miss count?
No. Here, reach equals entry count multiplied by page size. It does not count actual misses or model associativity, competing translations or access order.
Are HugeTLB and THP the same interface?
No. Linux documents HugeTLB and Transparent Hugepage support as distinct mechanisms, with different allocation and management behavior. This lab configures neither.
Can large pages waste memory?
Yes. For the aligned 2 MiB-page example, 2 MiB plus one byte needs two pages. The unused tail is explicit; real allocation behavior needs platform evidence.
Sources & model boundaries
Primary references used for this explanation. The interactive example is an educational model, not a live check.
- Linux kernel: HugeTLB Pages
Overview. TLBs cache address translations; supported page sizes depend on architecture. HugeTLB provides an explicit large-page facility.
Checked .
- Linux kernel: Transparent Hugepage Support
Objective, introductory assumptions and memory-use example. THP is a distinct large-page mechanism. Larger mappings increase translation coverage but may allocate otherwise unused bytes; example sizes are not universal.
Checked .