Re: [PATCH 1/6] x86: drop unneded members of struct cpuinfo_x86
From: Borislav Petkov
Date: Tue Feb 14 2017 - 11:17:28 EST
On Sun, Feb 12, 2017 at 10:12:07PM +0100, Mathias Krause wrote:
> Those member serve no purpose -- not even fill padding for alignment or
> such. So just get rid of them.
Well, almost. You need the wp_works_ok removal patch too, otherwise you
have the 3 bytes hole below.
But the wp_works_ok goes away too so I guess that's fine.
$ pahole -C cpuinfo_x86 vmlinux
struct cpuinfo_x86 {
__u8 x86; /* 0 1 */
__u8 x86_vendor; /* 1 1 */
__u8 x86_model; /* 2 1 */
__u8 x86_mask; /* 3 1 */
char wp_works_ok; /* 4 1 */
__u8 x86_virt_bits; /* 5 1 */
__u8 x86_phys_bits; /* 6 1 */
__u8 x86_coreid_bits; /* 7 1 */
__u8 cu_id; /* 8 1 */
/* XXX 3 bytes hole, try to pack */
__u32 extended_cpuid_level; /* 12 4 */
int cpuid_level; /* 16 4 */
__u32 x86_capability[19]; /* 20 76 */
/* --- cacheline 1 boundary (64 bytes) was 32 bytes ago --- */
char x86_vendor_id[16]; /* 96 16 */
char x86_model_id[64]; /* 112 64 */
/* --- cacheline 2 boundary (128 bytes) was 48 bytes ago --- */
int x86_cache_size; /* 176 4 */
int x86_cache_alignment; /* 180 4 */
int x86_cache_max_rmid; /* 184 4 */
int x86_cache_occ_scale; /* 188 4 */
/* --- cacheline 3 boundary (192 bytes) --- */
int x86_power; /* 192 4 */
long unsigned int loops_per_jiffy; /* 196 4 */
u16 x86_max_cores; /* 200 2 */
u16 apicid; /* 202 2 */
u16 initial_apicid; /* 204 2 */
u16 x86_clflush_size; /* 206 2 */
u16 booted_cores; /* 208 2 */
u16 phys_proc_id; /* 210 2 */
u16 logical_proc_id; /* 212 2 */
u16 cpu_core_id; /* 214 2 */
u16 cpu_index; /* 216 2 */
/* XXX 2 bytes hole, try to pack */
u32 microcode; /* 220 4 */
/* size: 224, cachelines: 4, members: 30 */
/* sum members: 219, holes: 2, sum holes: 5 */
/* last cacheline: 32 bytes */
};
--
Regards/Gruss,
Boris.
Good mailing practices for 400: avoid top-posting and trim the reply.