cc3f9dce33
To show just packed structs. For instance, here are the top packed structures in the Linux kernel, using BTF data: $ pahole --packed --sizes | sort -k2 -nr | head e820_table 64004 0 boot_params 4096 0 btrfs_super_block 3531 0 efi_variable 2084 0 ntb_info_regs 800 0 tboot 568 0 _legacy_mbr 512 0 disklabel 512 0 btrfs_root_item 439 0 saved_context 317 0 $ If you then look at: $ pahole e820_table struct e820_table { __u32 nr_entries; /* 0 4 */ struct e820_entry entries[3200]; /* 4 64000 */ /* size: 64004, cachelines: 1001, members: 2 */ /* last cacheline: 4 bytes */ } __attribute__((__packed__)); $ In arch/x86/include/asm/e820/types.h we have: /* * The whole array of E820 entries: */ struct e820_table { __u32 nr_entries; struct e820_entry entries[E820_MAX_ENTRIES]; }; I.e. no explicit __packed__ attributes, but if we expand this a bit: $ pahole -E e820_table struct e820_table { /* typedef __u32 */ unsigned int nr_entries; /* 0 4 */ struct e820_entry { /* typedef u64 -> __u64 */ long long unsigned int addr; /* 4 8 */ /* typedef u64 -> __u64 */ long long unsigned int size; /* 12 8 */ enum e820_type type; /* 20 4 */ } __attribute__((__packed__)) entries[3200]; /* 4 64000 */ /* size: 64004, cachelines: 1001, members: 2 */ /* last cacheline: 4 bytes */ } __attribute__((__packed__)); $ We see that is that entries member that is packed, because: $ pahole e820_entry struct e820_entry { u64 addr; /* 0 8 */ u64 size; /* 8 8 */ enum e820_type type; /* 16 4 */ /* size: 20, cachelines: 1, members: 3 */ /* last cacheline: 20 bytes */ } __attribute__((__packed__)); $ In arch/x86/include/asm/e820/types.h we have: /* * A single E820 map entry, describing a memory range of [addr...addr+size-1], * of 'type' memory type: * * (We pack it because there can be thousands of them on large systems.) */ struct e820_entry { u64 addr; u64 size; enum e820_type type; } __attribute__((packed)); So yeah, it is there, BTF doesn't explicitly states it is packed (as DWARF does) and pahole was able to infer that correctly. Tested-by: Richard Weinberger <richard@nod.at> Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com> |
||
---|---|---|
.. | ||
pahole.1 |