On Thu, Aug 20, 2020 at 06:15:15PM +0000, Luck, Tony wrote:
> >> How much does vmlinux size grow with your change?
> >>
> >
> > It seems to get smaller.
> >
> > -rwxrwxr-x   1 yghannam yghannam 807634088 Aug 20 17:51 vmlinux-32banks
> > -rwxrwxr-x   1 yghannam yghannam 807634072 Aug 20 17:50 vmlinux-64banks
> 
> You need to run:
> 
> $ size vmlinux
>    text    data     bss     dec     hex filename
> 20334755        12569682        14798924        47703361        2d7e541 
> vmlinux
> 
> Likely the extra space is added to the third element ("bss"). That doesn't 
> show
> up in the vmlinux file, but does add to memory footprint while running.

Thanks. Yeah, they're identical:
   text    data     bss     dec     hex filename
   15710076        13519306        5398528 34627910        2106146   
vmlinux-32banks
   15710076        13519306        5398528 34627910        2106146   
vmlinux-64banks

I did a quick audit of the statically allocated data structures which
use MAX_NR_BANKS.

Global bitmaps:
- core.c / mce_banks_ce_disabled
- core.c / all_banks
- core.c / valid_banks
- core.c / toclear
- Total: 32 new bits * 4 bitmaps = 16 new bytes

Per-CPU bitmaps:
- core.c / mce_poll_banks
- intel.c / mce_banks_owned
- Total: 32 new bits * 2 bitmaps = 8 new bytes

The bitmaps are arrays of longs. So this change will only affect 32-bit
execution (I assume), since there will be one additional long used.
There will be no additional memory use on 64-bit execution, because the
size of long is 64 bits.

Global structs:
- amd.c / struct smca_bank smca_banks[]: 16 bytes per bank
- core.c / struct mce_bank_dev mce_bank_devs[]: 56 bytes per bank
- Total: 32 new banks * (16 + 56) bytes = 2304 new bytes

Per-CPU structs:
- core.c / struct mce_bank mce_banks_array[]: 16 bytes per bank
- Total: 32 new banks * 16 bytes = 512 new bytes

32-bit
Total global size increase: 2320 bytes
Total per-CPU size increase: 520 bytes

64-bit
Total global size increase: 2304 bytes
Total per-CPU size increase: 512 bytes

Is this okay?

Thanks,
Yazen

Reply via email to