Re: [PATCH 4/6] perf annotate-data: Bound the member nesting recursion
From: Arnaldo Carvalho de Melo
Date: Fri Sep 25 2026 - 12:18:27 EST
On Fri, Sep 25, 2026 at 05:43:43PM +0200, Arnaldo Carvalho de Melo wrote:
> On Fri, Sep 25, 2026 at 08:39:21AM -0700, Namhyung Kim wrote:
> > On Fri, Sep 25, 2026 at 05:06:55PM +0200, Arnaldo Carvalho de Melo wrote:
> > > +++ b/tools/perf/util/annotate-data.h
> > > @@ -61,6 +61,9 @@ struct annotated_member {
> > > int size;
> > > bool is_union;
> > > bool is_flex_array;
> > > + unsigned int depth;
> > > + /* Children not expanded because the nesting limit was reached */
> > > + bool truncated;
> > Nit: it'd be better to switch the order of the last two fields to reduce
> > the padding.
> I should have used pahole... 8-)
MAX_MEMBER_DEPTH is 32, so we can make it an u8, did it:
⬢ [acme@toolbx perf-tools-next]$ pahole -C annotated_member ~/bin/perf
struct annotated_member {
struct list_head node; /* 0 16 */
struct list_head children; /* 16 16 */
char * type_name; /* 32 8 */
char * var_name; /* 40 8 */
int offset; /* 48 4 */
int size; /* 52 4 */
_Bool is_union; /* 56 1 */
_Bool is_flex_array; /* 57 1 */
_Bool truncated; /* 58 1 */
u8 depth; /* 59 1 */
/* size: 64, cachelines: 1, members: 10 */
/* padding: 4 */
};
⬢ [acme@toolbx perf-tools-next]$
- Arnaldo