arXiv:2611.07506cs.OSNov 2026

Manuscript Offprint

arXiv:2611.07506

Memory Fit: Architectural Support for Page Placement by Learning Models of Good Behavior

Chun Deng, Hui Sub Shim, Evan Laufer, Anna Eaton, David Tennenhouse, Tsachy Weissman, Philip Levis

Chun Deng

Stanford University

USA

dengchun@stanford.edu

Hui Sub Shim

Stanford University

USA

hsshim@stanford.edu

Evan Laufer

Stanford University

USA

emlaufer@stanford.edu

Anna Eaton

Stanford University

USA

acbeaton@stanford.edu

David Tennenhouse

Independent Researcher

dtennenhouse@ieee.org

Tsachy Weissman

Stanford University

USA

tsachy@stanford.edu

Philip Levis

Stanford University and

Google

USA

pal@cs.stanford.edu

Abstract

Server main memory is increasingly heterogeneous, incorporating technologies such as zswap, CXL memory expanders, and emerging phase-change memories (PCM). To decide where to place pages, operating systems have to choose between efficient but coarse-grained access bits, out-of-band profiling, or costly runtime instrumentation.

This paper proposes memory fit, a hardware abstraction that provides precise and accurate page placement information to an operating system. Memory fit measures how well a page “fits” each type of memory in the system. Memory fit separates the mechanism of measuring affinity between pages and memories from the OS policy of choosing which pages to move when. The paper describes soft trace matching (STM), a computationally and space efficient algorithm to compute memory fit. The key technical insight behind STM is that it can estimate memory fit by comparing accesses to a page with a learned model of “good” traces for a memory.

We have implemented memory fit and STM in a BOOMv3 RISC-V processor running Linux 6.6. On extended GUPS, memory fit placements recover 2.2–3.8× as much of the performance gap to optimal placement as Linux TPP. For Redis with equal DRAM and PCM capacities, placements selected by memory fit recover 80% of the performance gap, versus 19% for TPP, in a placement replay. Memory fit requires only 64 bits of state per 4 KiB page and can be updated on every main-memory access with only a 1.2% overhead of OS kernel notification processing.

1 Introduction

DRAM has grown to dominate the cost of modern servers [7, 15, 17]. Reducing this cost has motivated systems that combine several forms of memory. These include software-compressed memory such as zswap, CXL memory expanders, emerging phase-change memories and High Bandwidth Flash [4, 11, 30]. Each provides higher capacity per dollar (GB/$), with different latency, bandwidth, density, and read/write behavior.

The performance differences of these memories create a placement problem for an operating system: which pages should it place in each memory? Existing systems generally answer this question by measuring how frequently a page is accessed, describing it as page temperature. Hot pages are accessed frequently while cold ones are accessed rarely. Transparent Page Placement (TPP), for example, proactively moves cold pages out of local memory and reactively promotes hot pages [15]. HeMem and Memtis improve how the operating system measures and classifies page temperature [12, 20].

Temperature-based policies work well when there is a hierarchy of slow to fast memories: hotter pages benefit more from faster memory. As memory performance has become more complex, however, temperature is too coarse: two pages with the same temperature can observe different performance in the same memory. For example, memory-level parallelism means sometimes hot pages are better put in slower CXL memory [14], compression within a memory expander can make access cost depend on the contents of a page [18], and PCM can respond differently to reads, writes, and their ordering [30].

Processors today provide poor support for an operating system to make page placement decisions. Page-table entries provide accessed and dirty bits 1^{1} , which are efficient but coarse-grained, while more detailed mechanisms such as Intel PEBS and AMD IBS require sampling and impose a large software processing cost. 2^{2} Hardware–software code-sign approaches such as NEMO [13] and M5 [23] show how better hardware support for performance counters can substantially improve placement.

This paper takes a step back to ask two broader questions. How should a processor support an operating system's page placement policy? What abstraction should it provide? Examining the tradeoffs of different memory technologies and how page placement affects system performance, Section 2.4

1^{1}Some ARM processors lack hardware dirty-bit management [2].

2^{2}NEMO [13] explains the tradeoffs of memory measurement excellently.

derives three requirements for such an abstraction: it must be expressive enough to distinguish many different memories and access patterns, it must provide a very simple interface to software, and it must be fast enough to precisely measure accesses without delaying memory requests.

Section 3 describes memory fit, a hardware abstraction that meets all three requirements. A memory fit score measures how well a page's accesses match patterns that perform well in each memory. A 64-bit per-page record accommodates up to four eight-bit memory fit scores with a compressed access history. Memory fit scores are comparative. Comparing one page across memories indicates which memory is best for that page, while comparing page scores for a memory indicates how to allocate limited capacity. Memory fit separates mechanism from policy: hardware calculates an affinity signal between a page's accesses and each memory, while the operating system implements a policy that combines this signal with capacity, migration cost, and application constraints.

The primary research challenge that arises is computing memory fit precisely and efficiently with very limited state. Section 3.3 proposes soft trace matching (STM), a novel algorithm for computing memory fit. STM represents accesses as a sequence of reads and writes with normalized reuse distances. Building on decades of work in extremely fast hardware compression, its simplest form is a single table of learned weights; additional tables condition on history. The key takeaway is that, drawing from the information theory of compression, STM can learn extremely concise and accurate models for memory fit by seeing what "good" traces for each memory look like. STM measures the affinity between a trace and memory as the relative completion-time benefit of placing the same work in each memory.

We have implemented memory fit and STM in a BOOMv3 RISC-V FPGA processor and incorporated support in Linux 6.6. Using this implementation, we evaluate STM against Linux TPP using extended GUPS, Redis, and a memory-access workload derived from llama.cpp. On extended GUPS, STM recovers 72.4% of the optimal-to-worst placement cycle gap under static behavior and 71.9% when behavior reverses midway, compared with 19.2% and 33.3% for TPP. Across three Redis capacity ratios, STM recovers 37.1–90.4% of the all-slow-to-all-fast performance gap, while TPP recovers 7.9–31.8%.

This paper makes four contributions:

  • It defines memory fit as a comparative signal for placing pages across memories with different performance characteristics.
  • It presents STM, a learning-based algorithm for computing memory fit from page access patterns.
  • It presents and implements a hardware-software architecture that exposes memory fit to Linux while leaving placement policy in the operating system.

Figure

Figure 1. STM scores vary across Redis pages and over time.

  • It evaluates STM against Linux TPP and in combination with existing placement policies.

Section 2 describes memory fit. Sections 3 and 4 describe its architecture and implementation. Section 5 evaluates a complete Linux system with memory fit, Section 6 discusses related work, and Section 7 concludes.