Re: [PATCH 0/2] tracing: Have trace_pid_list be a sparse array

From: Eugene Syromyatnikov
Date: Fri Sep 24 2021 - 10:18:26 EST

On Fri, Sep 24, 2021 at 3:35 PM Masami Hiramatsu <mhiramat@xxxxxxxxxx> wrote:
> On Fri, 24 Sep 2021 09:16:27 -0400
> Steven Rostedt <rostedt@xxxxxxxxxxx> wrote:
> > I'm optimizing the top tiers for size, because they are likely to be empty.
> > Why add memory for something that will never be used, and can't be removed.
> > Note, the middle and lower tiers can be reused when they go empty, which is
> > a likely use case (at least when I test this using hackbench).

Makes sense; I was thinking about worse case scenarios—tracing
thousands+ processes, but those probably not as common and important.

> > I looked into xarray and it appears to be optimized for storing something,
> > where as I'm just interested in a sparse bitmask.
> I guess he suggested that store the bitmask in xarray. Anyway, both are
> OK to me. This is needed for reducing the memory.

Yes, the idea was to store pointers to bitset leaves in XArray and
leverage its radix tree implementation, at cost of somewhat lesser
efficiency (since XArray indices are longs and thus it employs more
intermediate levels on 64-bit architectures).

Eugene Syromyatnikov