regmap: Reorder fields in 'struct regmap_config' to save some memory
authorChristophe JAILLET <christophe.jaillet@wanadoo.fr>
Mon, 6 May 2024 19:33:33 +0000 (21:33 +0200)
committerMark Brown <broonie@kernel.org>
Tue, 7 May 2024 01:31:42 +0000 (10:31 +0900)
commit9b1fe0510494c989ab6a131ce8b97cdd02a1c869
treee85ec0e15b237bdc2caa6dd623fb29d01a2b5558
parent991b5e2aad870828669ca105f424ef1b2534f820
regmap: Reorder fields in 'struct regmap_config' to save some memory

On x86_64 and allmodconfig, this shrinks the size of 'struct regmap_config'
from 328 to 312 bytes.

This is usually a win, because this structure is used as a static global
variable.

When moving the kerneldoc fields, I've tried to keep the layout as
consistent as possible, which is not really easy!

Before:
/* size: 328, cachelines: 6, members: 55 */
/* sum members: 296, holes: 6, sum holes: 25 */
/* padding: 7 */
/* last cacheline: 8 bytes */

After:
/* size: 312, cachelines: 5, members: 55 */
/* sum members: 296, holes: 5, sum holes: 16 */
/* last cacheline: 56 bytes */

For the records, this is also widely used:
$git grep static.*regmap_config | wc -l
1327

Signed-off-by: Christophe JAILLET <christophe.jaillet@wanadoo.fr>
Link: https://lore.kernel.org/r/5e039cd8fe415dd7ab3169948c08a5311db9fb9a.1715024007.git.christophe.jaillet@wanadoo.fr
Signed-off-by: Mark Brown <broonie@kernel.org>
include/linux/regmap.h