Re: [PATCH] skx_edac: Move a few hundred bytes to text from data using const

From: Luck, Tony
Date: Mon Aug 22 2016 - 12:46:39 EST


On Sun, Aug 21, 2016 at 05:02:41PM -0700, Joe Perches wrote:
> Marking arrays as const makes for smaller data.

Joe,

"a few hundred" seems to be exaggeration.

Before:
$ size drivers/edac/skx_edac.ko
text data bss dec hex filename
8435 1024 24 9483 250b drivers/edac/skx_edac.ko

After:
$ size drivers/edac/skx_edac.ko
text data bss dec hex filename
8531 944 24 9499 251b drivers/edac/skx_edac.ko

so "data" was reduced by 80 bytes, but "text" went up by 96.

Net increase of 16 (perhaps because some padding for alignment???)

Making read-only data const is a good idea in general, but
do we want to do it if it *increases* kernel footprint?

-Tony