Re: [PATCH 03/24] perf: Add build id data in mmap2 event

From: Peter Zijlstra
Date: Tue Nov 10 2020 - 07:22:45 EST


On Tue, Nov 10, 2020 at 08:54:26AM -0300, Arnaldo Carvalho de Melo wrote:
> Em Tue, Nov 10, 2020 at 09:07:16AM +0100, Peter Zijlstra escreveu:
> > On Mon, Nov 09, 2020 at 10:53:54PM +0100, Jiri Olsa wrote:
> > > Adding support to carry build id data in mmap2 event.
> > >
> > > The build id data replaces maj/min/ino/ino_generation
> > > fields, whichc are also used to identify map's binary,
> > > so it's ok to replace them with build id data:
> > >
> > > union {
> > > struct {
> > > u32 maj;
> > > u32 min;
> > > u64 ino;
> > > u64 ino_generation;
> > > };
> > > struct {
> > > u8 build_id[20];
> > > u8 build_id_size;
> >
> > What's the purpose of a size field for a fixed size array? Also, I'd
> > flip the order of these fields, first have the size and then the array.
>
> There can be different types of build-ids, with different sizes,
> flipping the order of the fields is indeed sensible, as we could then
> support even larger build_ids if the need arises :)

3 whole bytes.. whooo!