[论文解读] User Mode Memory Page Allocation: A Silver Bullet For Memory Allocation?
本文提出了一种用户态页分配器,将内存页分配从内核转移到用户空间,实现对MMU页映射的直接、裸机访问。基准测试显示,0–8MB块的分配速度最高提升10倍,重分配速度提升4.5倍,实际应用性能最高提升5.68%,表明在完整操作系统支持和新型分配器API下,性能有望提升100倍。
This paper proposes a novel solution: the elimination of paged virtual memory and partial outsourcing of memory page allocation and manipulation from the operating system kernel into the individual process' user space - a user mode page allocator - which allows an application to have direct, bare metal access to the page mappings used by the hardware Memory Management Unit (MMU) for its part of the overall address space. A user mode page allocator based emulation of the mmap() abstraction layer of dlmalloc is then benchmarked against the traditional kernel mode implemented mmap() in a series of synthetic Monte-Carlo and real world application settings. Given the superb synthetic and positive real world results from the profiling conducted, this paper proposes that with proper operating system and API support one could gain a further order higher performance again while keeping allocator performance invariant to the amount of memory being allocated or freed i.e. a 100x performance improvement or more in some common use cases. It is rare that through a simple and easy to implement API and operating system structure change one can gain a Silver Bullet with the potential for a second one.
研究动机与目标
- 解决内存容量增长超过内存速度时,内核态内存分配带来的性能瓶颈问题。
- 探究将页分配移至用户空间是否能消除内核陷阱并降低分配开销。
- 评估用户态页分配器作为传统内核管理的mmap()调用替代方案的可行性与性能表现。
- 探索一种新型、与规模无关的分配器API的潜力,支持批量分配并避免地址重分配。
- 确定用户态页分配是否能为现代内存密集型工作负载开启新一代高性能内存分配器。
提出的方法
- 设计并实现一种用户态页分配器,通过用户空间内存管理模拟mmap()系统调用接口。
- 在合成蒙特卡洛工作负载和实际应用中,将用户态分配器与标准内核态mmap()进行基准测试对比。
- 使用二进制修补技术,将未修改的二进制文件中的系统分配器替换为用户态分配器,以模拟真实部署环境。
- 测量不同块大小(0–8MB)、分配模式和内存访问特征下的性能表现。
- 分析缓存行为和页错误影响,评估减少缓存污染是否对性能提升有贡献。
- 提出并引用N1527 C1X malloc API扩展,支持批量分配和提示,以提升分配器效率。
实验结果
研究问题
- RQ1用户态页分配能否消除内存分配期间内核陷阱带来的性能损失?
- RQ2用户态页分配在不同内存块大小下是否实现与规模无关的性能表现?
- RQ3避免页错误处理程序导致的缓存污染减少,对分配性能有何影响?
- RQ4在无需源代码修改的情况下,用户态页分配对实际应用性能的提升程度如何?
- RQ5与传统内核管理的分配方式相比,所提出的用户态方法在碎片化、局部性和可扩展性方面表现如何?
主要发现
- 用户态页分配器在最大1MB块大小范围内实现了与规模无关的性能表现,表明其行为在不同分配大小下保持一致。
- 在0–8MB块大小范围内,用户态分配器相较内核态mmap()调用最高实现10倍性能提升。
- 使用用户态分配器后,块重分配性能最高提升4.5倍,表明重分配操作的开销显著降低。
- 在非分页内存环境下,极小块分配的性能提升达2倍,可能归因于避免页错误处理程序带来的缓存污染减少。
- 在二进制修补应用的实际测试中,除一个场景外其余均表现性能提升,平均提升1.88%,中位数提升1.20%。
- 研究表明,在完整操作系统支持和API支持下,性能有望进一步提升10至100倍,尤其在频繁或大规模分配的工作负载中更为显著。
更好的研究,从现在开始
从阅读论文到最终审阅,大幅缩短您的研究时间。
无需绑定信用卡
本解读由 AI 生成,并经人工编辑审核。