From: Andrii Nakryiko <andriin@xxxxxx> pahole --reorganize is calling class__find_holes() multiple times on the same struct to re-calculate holes. If it so happens that after reorg last struct's member had hole previously, we are not going to clear it out, which will lead to weird output and BFA, like this: $ pahole -F btf --reorganize -C netns_frags ~/tmp/vmlinux-default struct netns_frags { long int high_thresh; /* 0 8 */ long int low_thresh; /* 8 8 */ int timeout; /* 16 4 */ int max_dist; /* 20 4 */ struct inet_frags * f; /* 24 8 */ atomic_long_t mem; /* 32 8 */ /* XXX 24 bytes hole, try to pack */ /* --- cacheline 1 boundary (64 bytes) --- */ struct rhashtable rhashtable; /* 64 136 */ /* XXX 56 bytes hole, try to pack */ /* size: 200, cachelines: 4, members: 7 */ /* sum members: 176, holes: 1, sum holes: 80 */ /* last cacheline: 8 bytes */ /* BRAIN FART ALERT! 200 bytes != 176 (member bytes) + 0 (member bits) + 80 (byte holes) + 0 (bit holes), diff = -448 bits */ }; /* saved 120 bytes and 1 cacheline! */ After this change: $ pahole -F btf --reorganize -C netns_frags ~/tmp/vmlinux-defaultstruct netns_frags { long int high_thresh; /* 0 8 */ long int low_thresh; /* 8 8 */ int timeout; /* 16 4 */ int max_dist; /* 20 4 */ struct inet_frags * f; /* 24 8 */ atomic_long_t mem; /* 32 8 */ /* XXX 24 bytes hole, try to pack */ /* --- cacheline 1 boundary (64 bytes) --- */ struct rhashtable rhashtable; /* 64 136 */ /* size: 200, cachelines: 4, members: 7 */ /* sum members: 176, holes: 1, sum holes: 24 */ /* last cacheline: 8 bytes */ }; /* saved 120 bytes and 1 cacheline! */ Signed-off-by: Andrii Nakryiko <andriin@xxxxxx> --- dwarves.c | 3 +++ 1 file changed, 3 insertions(+) diff --git a/dwarves.c b/dwarves.c index 0d38ca3..1c2df05 100644 --- a/dwarves.c +++ b/dwarves.c @@ -1205,6 +1205,9 @@ void class__find_holes(struct class *class) if (pos->is_static) continue; + pos->bit_hole = 0; + pos->hole = 0; + bit_start = pos->bit_offset; if (pos->bitfield_size) { bit_end = bit_start + pos->bitfield_size; -- 2.17.1