Ring library optimization idea

Honnappa Nagarahalli Honnappa.Nagarahalli at arm.com
Mon Aug 21 06:40:25 CEST 2023



> -----Original Message-----
> From: Morten Brørup <mb at smartsharesystems.com>
> Sent: Sunday, August 20, 2023 4:24 AM
> To: dev at dpdk.org
> Cc: Honnappa Nagarahalli <Honnappa.Nagarahalli at arm.com>;
> konstantin.v.ananyev at yandex.ru
> 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



More information about the dev mailing list