Skip to main content

TLB_RANGE_THRESHOLD_PAGES

Constant TLB_RANGE_THRESHOLD_PAGES 

Source
pub const TLB_RANGE_THRESHOLD_PAGES: usize = 64;
Expand description

Page-count threshold above which a ranged shootdown falls back to a full CR3 reload (shootdown_all) rather than issuing one invlpg per page.

Rationale: on x86, a CR3 write flushes all non-global TLB entries in a single pipeline stage. Individual invlpg instructions have a per-entry cost that grows linearly with the number of pages. Empirically, the crossover point is around 32–64 pages (µarch-dependent); 64 is a conservative upper bound that keeps the fast path below ~256 ns on modern hardware while avoiding spurious full flushes on small vmalloc frees.

The same constant governs both the sender side (shootdown_range, local_range) and the receiver side (IPI handler’s Range arm) so the two never disagree on what “small range” means.