Ghost cache entry
In history-based cache policies, a ghost entry records a nonresident item's identity or history without retaining its cached payload.
An ARC history hit is still a cache miss requiring a fetch. [1]
In FAST 2003 ARC, the cache and ghosts remember at most twice the cache capacity in page identities. If T1 holds c pages, a new-page miss discards its oldest entry without adding it to a ghost list. An initially empty cache receiving only distinct requests can fill T1 while both ghost lists stay empty. [1]
A history hit fetches the page into T2 and adjusts recency target p within [0, c]. With B1 containing 2 entries and B2 containing 6, a B1 hit requests an increase of 3 before the capacity cap. For c = 10, p moves from 9 to 10, not to 12. [1] [8]
2Q keeps an out-queue of identifiers evicted from its first-access queue and promotes a page found there to the main queue. [3] The MQ experiments used FIFO history for four times the resident block count; a reload uses the remembered count plus one. [4] LIRS tracks nonresident blocks in its stack and promotes a re-accessed one to low-reuse-distance status. [5]
Linux can keep history in its page-cache index. Eviction leaves a counter snapshot as a shadow entry. On refault the counter difference gives a distance used to decide immediate activation. The v6.12 comment estimates shadow-node reclaim near 1.8% of available memory on 64-bit with seven nodes per page and 64 slots per node, not a hard memory cap. [6]
LRU-K keeps reference history separately from cached pages. Putting updated timestamps in a page header would force otherwise clean pages to be written back on eviction. Discarding history with the payload can instead make recurring pages look new. Its retained-information period bounds history lifetime, not payload residence. [7]
LARC history can describe blocks that never entered the payload cache. [10]
Relations
- related
- Adaptive Replacement Cache, Cache pollution, SSD mapping cache, Least recently used replacement, First-in first-out cache replacement, CLOCK cache replacement, CLOCK-Pro, 2Q replacement, Multi-Queue cache replacement, Linux refault distance, Flashield, LeCaR, CACHEUS, MIMIR, Cliffhanger, GL-Cache, Lazy Adaptive Replacement Cache
Advantages
- A small history separates re-requested items from first-time ones, so one-time scans can be filtered out while reused items are promoted. [3, 1]
Limitations
- For four history entries per 8 KiB block, entries of h bytes use 4h/8192 of resident payload. With h < 32 this is below 1.5625%, not a measured overhead or a bound on total implementation memory. [4]
- History without a bound, as in LIRS according to the ARC authors, can have unbounded space overhead. [1, 5]
- Flashield uses ghost for a different state: current data can remain readable before segment reclamation. [9]
Citations
- Megiddo and Modha. ARC: A Self-Tuning, Low Overhead Replacement Cache. FAST 2003, section III(A); Figure 4, cases II and IV(A).
- Johnson and Shasha. 2Q: A Low Overhead High Performance Buffer Management Replacement Algorithm. VLDB 1994, pp. 439-450.
- Zhou, Philbin and Li. The Multi-Queue Replacement Algorithm for Second Level Buffer Caches. USENIX ATC 2001.
- Jiang and Zhang. LIRS: An Efficient Low Inter-reference Recency Set Replacement Policy to Improve Buffer Cache Performance. SIGMETRICS 2002.
- Linux v6.12 mm/workingset.c, leading comment on double CLOCK lists and shadow entries.
- O'Neil, O'Neil and Weikum. The LRU-K Page Replacement Algorithm for Database Disk Buffering. SIGMOD 1993, section 2.1.2, p. 301.
- Hesela. ARC directory occupancy and bounded target updates: worked arithmetic and code.
- Eisenman et al. Flashield. NSDI 2019, section 4.3.
- Huang, Wei, Chen, Chen and Feng. Improving Flash-based Disk Cache with Lazy Adaptive Replacement. MSST 2013, sections III and V.B; Algorithm 1.
Further reading
Sources & caveats
- The ARC paper has an author at an industrial research laboratory, the multi-queue paper is by an industrial research institute and a university, the 2Q paper has one author also at a software company, and LIRS is university work read from technical report TR-02-6.
- The MQ paper reports history overhead below 0.5%. At four entries per 8 KiB block this requires average entries below 10.24 bytes. The stated h < 32 bound alone does not establish it; the bounds are not a contradiction.
- The kernel behaviour is from the v6.12 source comments; 8 / (7 x 64) = 1.79% matches the comment figure of 1.8%.
- Arithmetic from the ARC rule: 6 / 2 = 3; a 1,000-page cache has a directory of at most 2,000 identifiers.
- The sources cover general buffer caches and a page cache, not SSD mapping caches; their trace results are not repeated.
- The 2c bound counts directory identities, not payload bytes or implementation metadata bytes. The cold-scan arithmetic follows Figure 4 under its stated assumptions; it is not a full ARC implementation.