This paper presents GMEM, generalized memory management, for peripheral devices. GMEM provides OS support for centralized memory management of both CPU and devices. GMEM provides a high-level interface that decouples MMU-specific functions. Device drivers can thus attach themselves to a process's address space and let the OS take charge of their memory management. This eliminates the need for device drivers to "reinvent the wheel" and allows them to benefit from general memory optimizations integrated by GMEM. Furthermore, GMEM internally coordinates all attached devices within each virtual address space. This drastically improves user-level programmability, since programmers can use a single address space within their program, even when operating across the CPU and multiple devices. A case study on device drivers demonstrates these benefits. A GMEM-based IOMMU driver eliminates around seven hundred lines of code and obtains 54% higher network receive throughput utilizing 32% less CPU compared to the state-of-the-art. In addition, the GMEM-based driver of a simulated GPU takes less than 70 lines of code, excluding its MMU functions.
翻译:本文提出了面向外围设备的通用内存管理框架GMEM。该框架为操作系统提供了对CPU和设备统一内存管理的支持。GMEM通过高层接口解耦了内存管理单元(MMU)的特定功能,使得设备驱动程序能够接入进程的地址空间,由操作系统接管其内存管理。这不仅避免了设备驱动"重复造轮子",还能让它们受益于GMEM集成的通用内存优化策略。此外,GMEM在内部协调每个虚拟地址空间中的附属设备,显著提升了用户态编程的便利性——程序员可在程序中共享统一地址空间,即使涉及CPU与多设备间的协同操作。面向设备驱动的案例研究证实了上述优势:基于GMEM的IOMMU驱动减少约七百行代码,相比现有最优方案,网络接收吞吐量提升54%,CPU占用降低32%。同时,基于GMEM的模拟GPU驱动(不含MMU功能)代码量不足70行。