在mmap调用中跳过对复用页的TLB刷新
Skip TLB flushes for reused pages within mmap's
AI总结:
针对TLB跨核失效导致的性能瓶颈,本研究提出mmap系统调用的快速页回收(FPR)特性,无需硬件改动即可在Linux内核中透明运行,最高可将实际应用性能提升28%。
摘要:
通过在CPU的转译后备缓冲器(Translation Lookaside Buffers,TLBs)中缓存近期的地址转换结果,内存访问效率可得到显著提升。但由于操作系统无法获知哪个核心正在使用某一特定映射,每当地址被取消映射时,操作系统都会刷新应用运行所在的所有核心上的TLB表项,以此保障安全性与一致性。这类TLB刷新操作被称为TLB shootdown(TLB跨核失效),其开销极高,已成为性能与可扩展性的瓶颈。内存映射I/O是引发TLB shootdown的主要因素之一,尤其是在mmap-munmap循环与页缓存回收过程中。通常情况下,相同的物理页在被回收后会被重新分配给同一进程,这为操作系统降低TLB shootdown的发生频率提供了契机。我们证明,通过对mmap函数进行小幅扩展,即可避免针对这类“回收页”的TLB shootdown。\n 为此,我们在mmap系统调用中提出并实现了“快速页回收”(fast page recycling,FPR)特性。FPR-mmap仅在页面退出其回收周期并被分配给其他进程时才触发TLB shootdown,以此保障安全性。为确保使用FPR-mmap指针时的一致性,我们对虚拟内存管理做了细微调整,以避免ABA问题。与以往缓解shootdown影响的方法不同,我们的方案无需任何硬件改动,可在现有Linux虚拟内存框架内透明运行。\n 我们在多种CPU、内存与存储配置(包括持久内存与Optane SSD)下开展了评估,结果表明FPR可带来显著的性能提升:实际应用中的性能提升最高达28%,微基准测试中的提升最高达92%。此外,我们还证实TLB shootdown是一类重要的瓶颈来源,此前一直被错误归因于Linux内核的其他组件。
英文摘要:
Memory access efficiency is significantly enhanced by caching recent address translations in the CPUs' Translation Lookaside Buffers (TLBs). However, since the operating system is not aware of which core is using a particular mapping, it flushes TLB entries across all cores where the application runs whenever addresses are unmapped, ensuring security and consistency. These TLB flushes, known as TLB shootdowns, are costly and create a performance and scalability bottleneck. A key contributor to TLB shootdowns is memory-mapped I/O, particularly during mmap-munmap cycles and page cache evictions. Often, the same physical pages are reassigned to the same process post-eviction, presenting an opportunity for the operating system to reduce the frequency of TLB shootdowns. We demonstrate, that by slightly extending the mmap function, TLB shootdowns for these "recycled pages" can be avoided. Therefore we introduce and implement the "fast page recycling" (FPR) feature within the mmap system call. FPR-mmaps maintain security by only triggering TLB shootdowns when a page exits its recycling cycle and is allocated to a different process. To ensure consistency when FPR-mmap pointers are used, we made minor adjustments to virtual memory management to avoid the ABA problem. Unlike previous methods to mitigate shootdown effects, our approach does not require any hardware modifications and operates transparently within the existing Linux virtual memory framework. Our evaluations across a variety of CPU, memory, and storage setups, including persistent memory and Optane SSDs, demonstrate that FPR delivers notable performance gains, with improvements of up to 28% in real-world applications and 92% in micro-benchmarks. Additionally, we show that TLB shootdowns are a significant source of bottlenecks, previously misattributed to other components of the Linux kernel.
机构、总结、中文摘要均由AI分析而来,可能存在错误,请以论文正文为准。