Skip to content

Add Merlin eviction algorithm and fix capacity remainders in SR-LRU and SLRU - #343

Merged
haochengxia merged 2 commits into
1a1a11a:developfrom
fexuile:feat/merlin
Sep 30, 2026
Merged

haochengxia merged 2 commits into
1a1a11a:developfrom
fexuile:feat/merlin

Conversation

@fexuile

@fexuile fexuile commented Sep 30, 2026

Copy link
Copy Markdown
Contributor

What does this PR do?

Add the Merlin eviction algorithm, based on MerlinOSDI26AE. Merlin combines filter, staging, and core FIFO queues with ghost history and a counting Bloom filter to guide admission and promotion. This change integrates Merlin into the build, algorithm registry, CLI, and cache object metadata.

Fix capacity splitting in SR-LRU, which Cacheus also uses, and in SLRU and SLRUv0. SR-LRU previously assigned floor(cache_size / 2) to both resident queues: a capacity of 101 therefore produced a total budget of 100. It now assigns the remainder to the second queue. SLRU and SLRUv0 distribute remainder bytes to the upper segments so that segment budgets sum to the requested capacity. Explicit SLRU segment weights retain their existing behavior.

The changes are separated into two commits:

  • feat: Add Merlin algo
  • fix: preserve capacity remainders in SR-LRU and SLRU

Type of change

  • Bug fix
  • New eviction / admission / prefetch algorithm
  • New trace reader or trace format
  • Performance improvement
  • Documentation
  • Build / CI
  • Other:

How was it tested?

cd _build && ./bin/cachesim ../data/cloudPhysicsIO.vscsi vscsi merlin 1mb

  • ctest --test-dir _build --output-on-failure passes
  • Build is warning-free (CI uses -Wall -Wextra -Werror)

Checklist

  • Formatted with clang-format (or the pre-commit hook from scripts/setup_hooks.sh)
  • Added or updated tests
  • Added or updated documentation
  • New algorithms are registered in the CLI and listed in the README

- Add Merlin eviction algorithm in cpp/merlin.cpp. The details of this algorithm are in [MerlinOSDI26AE](https://github.com/TELOS-syslab/MerlinOSDI26AE).
- Add merlin_init declaration to evictionAlgo.h
- Add merlin's metadata object information in cacheObj.h
- Register an entry for Merlin in cacheAlgoRegistry.c
- Add cpp/merlin.cpp to CMakeLists.txt build
SR-LRU initialized both resident queues to floor(cache_size / 2), so
Cacheus and standalone SR-LRU lost one byte for odd capacities. Allocate
SR first and give R the remaining capacity using integer subtraction.
This preserves the requested resident budget without floating-point
rounding, including capacities above 2^53.

SLRU and SLRUv0 similarly truncated each equally sized segment. Assign
remainder bytes to the upper segments so their total matches the cache
capacity and objects admitted into lower segments fit after promotion.
Explicit SLRU segment weights and capacities divisible by the segment
count retain their existing layouts.
@haochengxia

Copy link
Copy Markdown
Collaborator

LGTM

@haochengxia
haochengxia merged commit 93529a1 into 1a1a11a:develop Sep 30, 2026
6 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants