Linux is the foundation of the digital age, accounting for the majority of the cloud and mobile OS markets. Any device that runs Linux uses the Linux page cache, a central pillar in OS and application performance, serving to reduce extraneous disk access. Many page cache eviction policies have been developed but remain bound by the rigidity of heuristics. The rise of AI-driven tools in recent years, melded with the ever-increasing variety of workloads for Linux devices, sets the stage for machine-learning-driven cache eviction policies. Promising research has been done in this field, but only in the field of user-space applications such as CDNs. We develop LearnedCache, an eBPF-integrated single-layer perceptron-based cache eviction policy for the Linux page cache, trained on real kernel data from diverse workloads. We demonstrate median AUCs of nearly 80% over multiple linear models modeling page reuse time, then take a step further by embedding these models inside the Linux kernel for real-time performance evaluation. Through statistical testing over 50 paired trials against a baseline of FIFO for each workload, LearnedCache reveals that machine-learning-derived cache eviction policies are practical in the Linux kernel under representative empirical workloads and are able to surpass conventional FIFO by statistically significant margins of up to 10% in insertion rate, a frequency-adjusted derivation of cache hit rate, in specific workloads while incurring minimal overhead.
翻译:Linux是数字时代的基石,占据了云和移动操作系统市场的主要份额。任何运行Linux的设备都使用Linux页面缓存,这是操作系统和应用程序性能的核心支柱,旨在减少不必要的磁盘访问。虽然已开发出许多页面缓存驱逐策略,但它们仍受限于启发式方法的僵化性。近年来人工智能驱动工具的兴起,以及Linux设备工作负载多样性的持续增加,为机器学习驱动的缓存驱逐策略奠定了基础。该领域虽已有前景可观的研究,但仅限于CDN等用户空间应用。我们开发了LearnedCache——一种基于eBPF集成的单层感知器的Linux页面缓存驱逐策略,使用来自多样化工作负载的真实内核数据进行训练。我们证明了在多个建模页面重用时间的线性模型上,中位AUC接近80%,并进一步将这些模型嵌入Linux内核以实现实时性能评估。通过在每个工作负载上基于FIFO基线进行的50组配对试验的统计测试,LearnedCache表明在代表性经验工作负载下,机器学习派生的缓存驱逐策略在Linux内核中具有实用性,能够在特定工作负载中以统计显著的优势(插入率提升高达10%,这是缓存命中率的频率调整衍生指标)超越传统FIFO,同时仅引入极小的开销。