简体   繁体   English

有没有一种方法可以使高速缓存中的空Boost循环缓冲区的前端保持高温?

[英]Is there a way to keep the front of an empty boost circular buffer hot in cache?

There is a specific circular buffer I wish to keep hot in cache, however it can go unused for extended periods of time. 我希望有一个特定的循环缓冲区在高速缓存中保持高温,但是可以长时间不使用它。 This is causing cache misses. 这导致高速缓存未命中。

I have an idle loop that can take responsibility for keeping the location hot, but I cannot see a way to do this using only the public interface without actually inserting/removing items. 我有一个空闲循环,可以负责使位置保持高温,但是我看不到一种方法,该方法仅使用公共接口而不实际插入/删除项目。

Is there any action, using the public interface, that when the circular buffer is empty, will keep the insertion point hot in cache? 使用公共接口是否有任何操作,当循环缓冲区为空时,将插入点保持在高速缓存中?

You may like to warm up your full fast path periodically by executing it in full and stopping as short from committing the effects of it as possible. 您可能希望定期执行完整的快速路径 ,并尽可能短地停止施加其影响,从而预热完整的快速路径

If you can get hold of a pointer to the front of the container you can use __builtin_prefetch on it to bring it into the cache. 如果可以获得指向容器前端的指针,则可以在容器上使用__builtin_prefetch将其带入缓存。 Alternatively, push and pop an element. 或者, pushpop一个元素。

You might want to look into using CAT (Cache Allocation Technology). 您可能想研究使用CAT(缓存分配技术)。 I'm not sure where it's at, at the moment, but see https://lwn.net/Articles/694800/ for where Linux was with it July 2016. 我现在不确定它在哪里,但是请参阅https://lwn.net/Articles/694800/,了解Linux在2016年7月的使用情况。

CAT is an Intel thing to separate pieces of cache and dedicate them to different purposes. CAT是Intel的事情,它可以将缓存分开并将其专用于不同的目的。 Threads assigned one piece of cache cannot evict data belonging to other pieces, although I believe they can still make use of reading it. 分配了一个缓存的线程无法驱逐属于其他缓存的数据,尽管我相信它们仍可以利用读取数据来进行。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM