Re: [PATCH v4 12/22] lib/stackdepot: use read/write lock

From: Andi Kleen
Date: Wed Jan 10 2024 - 18:01:44 EST


Oscar Salvador <osalvador@xxxxxxx> writes:
>>
>> With this change, multiple users can still look up records in parallel.

That's a severe misunderstanding -- rwlocks always bounce a cache line,
so the parallelism is significantly reduced.

Normally rwlocks are only worth it if your critical region is quite long.

>>
>> This is preparatory patch for implementing the eviction of stack records
>> from the stack depot.
>>
>> Reviewed-by: Alexander Potapenko <glider@xxxxxxxxxx>
>> Signed-off-by: Andrey Konovalov <andreyknvl@xxxxxxxxxx>
>
> Reviewed-by: Oscar Salvador <osalvador@xxxxxxx>


Has anyone benchmarked this on a high core count machine? It sounds
pretty bad if every lock aquisition starts bouncing a single cache line.

Consider using RCU or similar.

-Andi