Linux内核中的slab内存管理上的缓存着色 [英] cache coloring on slab memory management in Linux kernel

查看:523
本文介绍了Linux内核中的slab内存管理上的缓存着色的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我最近读到了平板系统的缓存颜色,但不了解. 为什么在不同平板中为对象添加各种偏移量的缓存着色可以提高性能?

I recently reads about the cache coloring of slab system and didn't understand. Why the cache coloring that adds various offsets to object in different slabs could enhance performance?

我最初的猜测是: 带有缓存偏移量的平板分配器,请尝试将平板的第一个对象放置在具有不同缓存颜色的内存中.如果客户端从这些平板分配N个对象,则它将获得具有N个缓存颜色的N个对象.

My initial guess is: the slab allocator with cache offsets, try to put first objects of slabs at memory of different cache color. If a client allocate N objects from these slabs, it will get N objects with N cache colors.

我的猜测是否正确,或者有人可以给我更多提示吗? 非常感谢,

Is my guess correct or can someone give me more hints on this? thanks a lot,

推荐答案

我建议浏览"了解Linux虚拟内存"书-平板分配器一章.引用

I would suggest to go through "Understanding Linux virtual memory" book - slab allocator chapter. As it quotes,

平板分配器的最后一项任务是优化硬件缓存的使用.如果将对象包装到板中之后仍有剩余空间,则将剩余空间用于为板着色.平板着色是一种尝试使不同平板中的对象使用高速缓存中不同行的方案.通过将对象放置在平板中的不同起始偏移处,对象将可能在CPU高速缓存中使用不同的行,这有助于确保来自同一平板高速缓存的对象将不太可能相互刷新.

The final task of the slab allocator is optimal hardware cache use. If there is space left over after objects are packed into a slab, the remaining space is used to color the slab. Slab coloring is a scheme that attempts to have objects in different slabs use different lines in the cache. By placing objects at a different starting offset within the slab, objects will likely use different lines in the CPU cache, which helps ensure that objects from the same slab cache will be unlikely to flush each other.

我认为这回答了您的疑问.

I think this answers your doubt.

这篇关于Linux内核中的slab内存管理上的缓存着色的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆