On Mon, 2025-11-10 at 17:08 +0100, Christian König wrote:
On 11/10/25 16:55, Philipp Stanner wrote:
Lock + head (same cache line) + head->next head->next->next
when popping:
Lock + head + head->previous head->previous->previous
I don't see why you need a "current" element when you're always only touching head or tail.
The current element is the one you insert or remove.
That won't cause a cache miss because you have just created that element in the submitting CPU, owning it exclusively.
Now we're speaking mostly the same language :]
If you could RB my DRM TODO patches we'd have a section for drm/sched, and there we could then soonish add an item for getting rid of spsc.
https://lore.kernel.org/dri-devel/20251107135701.244659-2-phasta@kernel.org/
I can't find that in my inbox anywhere. Can you send it out one more with my AMD mail address on explicit CC? Thanks in advance.
I can see to it. But can't you download the mbox file on the link and import it in your mail client?
Lockless magic should always be justified by real world use cases.
By the way, back when spsc_queue was implemented, how large were the real world performance gains you meassured by saving that 1 cache line?
That was actually quite a bit. If you want a real world test case use glMark2 on any modern HW.
And yeah I know how ridicules that is, the problem is that we still have people using this as indicator for the command submission overhead.
If we were living in a world were you'd always need 5 cache lines than that would just be the reality. And 5 would already be better than 8. So what's the deal? It seems this was not about "too slow" but about "faster than".
There's two topics which often make us pay the high price of buggyness and low maintainability. One of them being limitless performance optimizations.
I think that correctness always trumps speed. How happy does it make your customer if your driver delivers 5 fps more, but the game crashes 2 times per hour? (which btw happens to me with Steam on my amd card. Sometimes there are even hangs without a reset happening, which is strange. I'll open a ticket next time I see it happen).
P.