加入收藏 | 设为首页 | 会员中心 | 我要投稿 李大同 (https://www.lidatong.com.cn/)- 科技、建站、经验、云计算、5G、大数据,站长网!
当前位置: 首页 > 综合聚焦 > 服务器 > Linux > 正文

Linux内核中的slab内存管理缓存着色

发布时间:2020-12-13 23:07:56 所属栏目:Linux 来源:网络整理
导读:我最近读到了关于slab系统的缓存着色并且不明白. 为什么缓存着色会在不同的平板中为对象添加各种偏移量可以提高性能? 我最初的猜测是: 具有缓存偏移的slab分配器,尝试将slabs的第一个对象放在不同缓存颜色的内存中.如果客户端从这些平板分配N个对象,它将获
我最近读到了关于slab系统的缓存着色并且不明白.
为什么缓存着色会在不同的平板中为对象添加各种偏移量可以提高性能?

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

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

解决方法

我建议通过“ Understanding Linux virtual memory”书 – 板块分配器章节.正如它引用的那样,

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.

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

(编辑:李大同)

【声明】本站内容均来自网络,其相关言论仅代表作者个人观点,不代表本站立场。若无意侵犯到您的权利,请及时与联系站长删除相关内容!

    推荐文章
      热点阅读