Memtis

Date: 240821 ~ 240822


本报告将对比纯硬件实现的页面管理方案,对 Memtis 进行分析。

Intro & Backgrounds

Target

不同属性 ( 时延、容量、成本 ) 的多种内存分层。

Motivation

#1

除了在硬件迁移方案中也关注的慢存 ( 容量层 ) 访存延迟外,这里还提出新的问题:Huge Memory 的地址转换成本。主要是指以传统粒度 ( ~4KB ) 将四级页表缓存在 TLB,在 TLB 容量不可能有大的提升的情况下,TLB Miss 概率将提高。

降低地址转换成本,可通过 Huge Page 实现。

  • 减少地址转换开销
  • 增大 TLB 翻译地址范围

劣势是面对热度倾斜页面,即大页中只有很少的 regions 是热区,造成快存容量浪费。在硬件策略中也有讨论,这引出了跟踪和迁移粒度问题。定义“访问偏度”,强调可变粒度的重要性。

Memtis 能够感知倾斜页面,并根据访问分布决定页面放置和动态调整页面大小 ( 粒度 )。

#2

令热页面位于 fast-tier memory,冷页面位于 capacity-tier memory.

The biggest limitation of prior systems is their inability to effectively classify page hotness across diverse memory configurations and workloads. They rely on various heuristics and/or pre-configured thresholds to identify hot pages. As a result, identified hot pages are often either smaller or larger than the fast tier capacity, so they fail to place the hottest pages on fast tier memory.

提到关键词 启发式方法

这段个人理解,是在说过去的工作未将快速层的容量纳入考量,从而无法保证热度 Top-N ( N 为快速层容量;一般很难选到 Top-N,只要是热页集的一个 |N| 的子集即可 ) 页面位于快速层。

现有方法也未将异常处理与迁移解耦,造成迁移位于关键路径上。本文将其异步地实现了。

#3

子页粒度为 4KB,仍然是 PTE 大小。这可能是通过性能计数器 ( Intel PEBS ) 能够跟踪的最低粒度。如果粒度控制由硬件实现,其精度可以更高,如 256B ( HSCC 应该是这个粒度 )。

Since such huge page split is an expensive operation involving data copy and TLB shootdown, Memtis carefully estimates the maximum benefit and splits only the most skewed, hottest huge pages as per the estimated benefit.

可变粒度基于访问偏度实现,如果访问偏度过高则按小页处理,否则默认大页。

Insights

#1

访问跟踪。一般有如下方案

  • Page Table-Based ( 这部分没太看懂,需要补一下 Related Works )
  • 硬件采样,如 PEBS

硬件采样。通过 Intel PEBS 或 AMD IBS,对 LLC Miss 等事件进行采样。优势是无论页面按大页或小页管理,都可以对 4KB 粒度采样。

如图 Fig.1, 需注意采样频率与跟踪精度之间平衡,过高频率 + 过多采样区 = CPU 占用爆表。

#2

对跟踪指标进行如下归纳

  • Recency ( 新近性 )
  • Frequency ( 频率 )

复习概念:多层架构中的排他 (exclusive) 与包容 (inclusive);分层 (tiered) 与缓存 (cached)

HYBRID2: 我又出现了

Memtis 和 RHPM 一样否认了基于缓存新近性的热度估计,以下列方案为代表

  • AutoNUMA: 最近访问
  • Nimble: 最近访问 ( 的一组页面 )
  • Tiering-0.8: approximate re-fault interval ( 重故障间隔 )

理由:无法利用访问历史。( to say, 方法简单精度低 )

基于访问频率的方法能够弥补新近性的缺陷,但“以非常有限的方式” (While access frequency retains more information than recency, most systems currently capture frequency in a very limited form (e.g., one bit in a scan interval.)

以下列方案为代表

  • TPP / Multi-CLK: 扩展 LRU,将 LRU 深度提升为 2
    • 在硬件策略中也见过类似方法,最近两次最少使用
  • AutoTiering: N-bit 历史向量 ( 熟悉的配方 ? )

这里可能是说,能够捕获的信息还是较少,无法对频率进行精确建模

#3

Threshold.

静态阈值方案,阈值为 1 即与类缓存方案统一。

  • AutoNUMA
  • AutoTiering
  • Nimble

阈值为 2,与扩展 LRU 方案统一。

  • TPP / Multi-CLK

动态阈值方案 ( 这一段需要补下课 )

The quality of hot and cold page detection critically affects the effectiveness of memory management systems.

  • MGLRU ( 多代 LRU )
  • 这里提到了 HeMem,虽然用的是静态阈值,但当一个页面达到阈值时,其他页面热度减半
    • (Miya: 竞争热度 ? 感觉是为了消除 ping-pong,但合理性存疑)

#4

Prior works identify hot pages upon page faults and migrate them to fast tier memory on the critical path. Doing so leads to extended blocking of the application during page fault, imposing overhead.

Also, it should migrate pages off the critical path (not in the page fault handler) to minimize additional latency.

Memtis 将页面迁移后台进行。硬件实现方案中也见过类似探讨,但面向的是存储控制器 ↔ DRAM 的层级,希望在总线层面并行以避免关键路径延迟。

#5

§2.3 大篇幅分析了地址转换开销,再次强调细粒度访问跟踪。

Address translation overhead is a well-known bottleneck in memory-intensive applications.

( 这个 “well-known” 的结论以前还真不知道,学习了 )

通过使用 Huge Pages 来降低开销,即使用第三级 PMD,而非第四级 PTE.

这导致迁移成本更高。考虑并不是所有区域都为热区,引入了冗余流量 ( CAMEO 也有较高的冗余流量,但因为基于新近性的判别精度低导致频繁迁移,原因不同 ),同时造成快速层容量浪费。

如图 Fig.2, 横轴为巨页利用率,纵轴为巨页访问频率。当并没有呈现正相关时,迁移巨页是浪费的。

Design