> -----Original Message-----
> From: Morten Brørup <[email protected]>
> Sent: Sunday, August 20, 2023 4:24 AM
> To: [email protected]
> Cc: Honnappa Nagarahalli <[email protected]>;
> [email protected]
> Subject: Ring library optimization idea
>
> Most of the fast path ring library functions access the two cache lines
> containing
> respectively the r->prod and r->cons structures.
>
> Some of the fast path functions also have to fetch r->capacity and r->mask,
> which reside in another cache line.
>
> What do you think about adding shadow variables of r->capacity and r->mask
> to the same cache line as r->prod, to improve ring library performance (by
> avoiding having to read a third cache line) when under CPU cache pressure?
Agree with the idea. I am not sure about the performance as these are read-only
data. IMO, we should not worry about it as it saves one cache line (but we do
not need to measure the performance). They will occupy 12B, but I do not see
how we will occupy the entire 64B of the cacheline in the near future.
Also, the shadow variables need to be part of both r->prod and r->cons.
>
> -Morten