Re: [PATCH v10 11/12] perf session: Add dso__session() and session-scoped allocation wrappers

From: Alireza Haghdoost

Date: Tue Nov 24 2026 - 18:56:23 EST


On Tue, Nov 24, 2026 at 02:31:08PM -0800, Ian Rogers wrote:
[...]
> +static bool perf_session__try_shrink(struct perf_session *session)
> +{
> + size_t freed;
> +
> + if (!session || perf_session__in_shrink)
> + return false;
> +
> + perf_session__in_shrink = true;
> + freed = perf_session__shrink(session);

Nothing calls these wrappers yet. Which allocations do you plan to
route through them? In v2, __symbols__insert_sorted() called
perf_session__realloc() while holding the symbols lock, and shrinking
then freed the array being reallocated. Knowing the call sites would
make it easier to check the locking. When callers are added, could a
caller hold dsos->lock or a symbols lock when the allocation fails?

Thanks,
Alireza