Re: [PATCH v5 2/5] perf dso: Allow reading DSO data from an explicit file

From: Alireza Haghdoost

Date: Sat Nov 21 2026 - 19:06:35 EST


Hi Namhyung,

On Sun, Oct 18, 2026 at 9:26 AM Namhyung Kim
<namhyung@xxxxxxxxxx> wrote:
> On Sun, Oct 18, 2026 at 08:09:41AM -0700, Alireza Haghdoost wrote:
> > Unless you are already working on this part, I can send a separate
> > series to make the data cache type-aware. The series will add a type
> > argument to the read API and keep separate cache state for each backing
> > file. I can then change the lazy loader to use the data cache again.
>
> Sounds good. Please go ahead!

I looked into this again after lazy loader v8 series [1] and built a
prototype before changing the DSO data cache.

v8 checks the file before each lazy-name lookup because the saved name
offsets are valid only for the file used to load the symbols. If that
file is replaced or overwritten, the same offsets can point to
different bytes and produce wrong names.

A type-aware cache would therefore need separate file and block state
for each binary type, validation before using cached blocks, and
invalidation when the file changes. It would also require changing the
lock order between the DSO lock and the data-cache open lock.

I measured a behavioral prototype on six workloads. Keeping cached
blocks for later name lookups did not give a measurable speedup. In
the many-DSO test it removed 64% of the pread() calls, but the run
time was unchanged because the file open and check still happen for
each lookup.

[1] https://lore.kernel.org/all/20261121-perf-symbol-memory-send-v8-0-370561cbb5a7@xxxxxxxx/

Thanks,
Alireza