• Ian Rogers's avatar
    perf callchain: Make brtype_stat in callchain_list optional · 6ba29fbb
    Ian Rogers authored
    struct callchain_list is 352bytes in size, 232 of which are
    brtype_stat. brtype_stat is only used for certain callchain_list
    items so make it optional, allocating when necessary. So that
    printing doesn't need to deal with an optional brtype_stat, pass
    an empty/zero version.
    
    Before:
    ```
    struct callchain_list {
            u64                        ip;                   /*     0     8 */
            struct map_symbol          ms;                   /*     8    24 */
            struct {
                    _Bool              unfolded;             /*    32     1 */
                    _Bool              has_children;         /*    33     1 */
            };                                               /*    32     2 */
    
            /* XXX 6 bytes hole, try to pack */
    
            u64                        branch_count;         /*    40     8 */
            u64                        from_count;           /*    48     8 */
            u64                        predicted_count;      /*    56     8 */
            /* --- cacheline 1 boundary (64 bytes) --- */
            u64                        abort_count;          /*    64     8 */
            u64                        cycles_count;         /*    72     8 */
            u64                        iter_count;           /*    80     8 */
            u64                        iter_cycles;          /*    88     8 */
            struct branch_type_stat    brtype_stat;          /*    96   232 */
            /* --- cacheline 5 boundary (320 bytes) was 8 bytes ago --- */
            const char  *              srcline;              /*   328     8 */
            struct list_head           list;                 /*   336    16 */
    
            /* size: 352, cachelines: 6, members: 13 */
            /* sum members: 346, holes: 1, sum holes: 6 */
            /* last cacheline: 32 bytes */
    };
    ```
    
    After:
    ```
    struct callchain_list {
            u64                        ip;                   /*     0     8 */
            struct map_symbol          ms;                   /*     8    24 */
            struct {
                    _Bool              unfolded;             /*    32     1 */
                    _Bool              has_children;         /*    33     1 */
            };                                               /*    32     2 */
    
            /* XXX 6 bytes hole, try to pack */
    
            u64                        branch_count;         /*    40     8 */
            u64                        from_count;           /*    48     8 */
            u64                        predicted_count;      /*    56     8 */
            /* --- cacheline 1 boundary (64 bytes) --- */
            u64                        abort_count;          /*    64     8 */
            u64                        cycles_count;         /*    72     8 */
            u64                        iter_count;           /*    80     8 */
            u64                        iter_cycles;          /*    88     8 */
            struct branch_type_stat *  brtype_stat;          /*    96     8 */
            const char  *              srcline;              /*   104     8 */
            struct list_head           list;                 /*   112    16 */
    
            /* size: 128, cachelines: 2, members: 13 */
            /* sum members: 122, holes: 1, sum holes: 6 */
    };
    ```
    Signed-off-by: default avatarIan Rogers <irogers@google.com>
    Cc: K Prateek Nayak <kprateek.nayak@amd.com>
    Cc: Ravi Bangoria <ravi.bangoria@amd.com>
    Cc: Sandipan Das <sandipan.das@amd.com>
    Cc: Anshuman Khandual <anshuman.khandual@arm.com>
    Cc: German Gomez <german.gomez@arm.com>
    Cc: James Clark <james.clark@arm.com>
    Cc: Nick Terrell <terrelln@fb.com>
    Cc: Sean Christopherson <seanjc@google.com>
    Cc: Changbin Du <changbin.du@huawei.com>
    Cc: liuwenyu <liuwenyu7@huawei.com>
    Cc: Yang Jihong <yangjihong1@huawei.com>
    Cc: Masami Hiramatsu <mhiramat@kernel.org>
    Cc: Miguel Ojeda <ojeda@kernel.org>
    Cc: Song Liu <song@kernel.org>
    Cc: Leo Yan <leo.yan@linaro.org>
    Cc: Kajol Jain <kjain@linux.ibm.com>
    Cc: Andi Kleen <ak@linux.intel.com>
    Cc: Kan Liang <kan.liang@linux.intel.com>
    Cc: Athira Rajeev <atrajeev@linux.vnet.ibm.com>
    Cc: Yanteng Si <siyanteng@loongson.cn>
    Cc: Liam Howlett <liam.howlett@oracle.com>
    Cc: Paolo Bonzini <pbonzini@redhat.com>
    Link: https://lore.kernel.org/r/20231024222353.3024098-10-irogers@google.comSigned-off-by: default avatarNamhyung Kim <namhyung@kernel.org>
    6ba29fbb
callchain.h 8.32 KB