随着多核/众核成为处理器结构发展的主流,并行任务间共享地使用Cache而导致的冲突越来越成为性能提升的瓶颈.利用页着色可以实现对Cache的分区管理,减少共享Cache导致的冲突.页着色的原理是利用内存与Cache之间的组相联映射关系,通过控制分配固定区域的内存而达到分配固定区域Cache的目的,这一方面限制了任务能够请求的物理内存范围,另一方面调整程序使用的Cache空间需要做大量的内存拷贝,带来了不可忽视的开销.为了克服页着色的缺点,文中通过动态内存分配的方式,只对动态分配的页进行着色,在不修改内核和程序源码的前提下实现了动态Cache分区.文中提出的动态内存分配策略(CachePM)会根据运行时环境为任务分配内存,避免不同任务间共享Cache的冲突和同一任务内出现Cache的访问热点,通过合理划分程序运行时动态分配的内存达到Cache分区的目的.当任务的运行环境改变时,CachePM自适应地改变已经分配的堆中数据在物理内存中的布局,以实现Cache分区的动态调节.为进一步降低动态页着色的开销,作者采用了减少和延迟内存拷贝的策略.实验表明,该方法能够有效实现动态Cache分区,从而提高并行运行的任务的性能;同时由于动态内存分配策略避免了同一任务内出现Cache访问热点,单独运行的任务的性能也较在libc下运行有所提升.
As multi-core/many-core becomes the trend of processor architecture, an increase of conflict miss in shared Cache has become more and more serious, which restricts performance improvement of parallel program. Recent researches use page coloring to implement Cache partition on real system for the purpose of reducing shared Cache conflict. However, page coloring has some inherent drawbacks when implementing Cache partition, including that it restricts the me- mory space a process can request, and it need unacceptable time consuming to achieve partition adjustment. Only coloring the dynamically allocated memory can remit memory pressure and reduce data move overhead. Thus, this paper proposes a Cache partition mechanism with page coloring, by designing a dynamic and light weight memory allocator. The data allocated can be partitioned and dynamically adjusted during runtime. Also, some policies to alleviate re-coloring overhead are introduced. These policies yield performance improvements for both co-running and single running tasks because their Cache usage are properly managed.