News for hackers. Stuff that matters.
Re:Wait-free queueing and ultra-low latency logging by dllthomas on Thursday May 29, 2014 @09:50AM (#7816185)
Nice - this is pretty much exactly my solution to the same problem. One thing I noticed on my architecture (not sure how well it generalizes) is that explicitly flushing the cacheline from the sending core dropped cache misses quite a bit.
Re:Wait-free queueing and ultra-low latency logging by nkurz on Thursday May 29, 2014 @01:32PM (#7817443)
Do you mean flushing it with _mm_clflush()/CLFLUSH? Which architecture, and what's your use case? Any theories on why this was helping?
Re:Wait-free queueing and ultra-low latency logging by dllthomas on Thursday May 29, 2014 @01:57PM (#7817602)
Right. Architecture is Sandy Bridge, use case is sending messages from one core to another.

The theory is straightforward: After I populate a message slot (sized at 1 cache line) in the ring buffer I know I'm not going to need to do anything with that memory on that core anytime soon. Pre-emptively evicting it from cache in favor of something that has a greater chance of being used soon has a chance of avoiding a cache miss. There remains the question of whether the CPU can figure out enough of this on its own. Empirically, the answer was "no" in my case.