Skip to content

Commit 995cf0e

Browse files
tititiou36broonie
authored andcommitted
regmap: Reorder 'struct regmap'
On a x86_64, with configured with allmodconfig, pahole states that the regmap structure is: /* size: 1048, cachelines: 17, members: 78 */ /* sum members: 1006, holes: 9, sum holes: 35 */ /* padding: 7 */ /* member types with holes: 2, total: 2 */ /* last cacheline: 24 bytes */ So, when such a struct is allocated, 2048 bytes are allocated, with most of this space being wasted. Move a few bools so that the size is reduced to 1024. After this change, pahole gives: /* size: 1024, cachelines: 16, members: 78 */ /* sum members: 1006, holes: 6, sum holes: 18 */ /* member types with holes: 2, total: 2 */ Signed-off-by: Christophe JAILLET <christophe.jaillet@wanadoo.fr> Link: https://patch.msgid.link/f01f900d15633d5cda5f27763723acb307c0d22f.1737725820.git.christophe.jaillet@wanadoo.fr Signed-off-by: Mark Brown <broonie@kernel.org>
1 parent 2014c95 commit 995cf0e

File tree

1 file changed

+6
-6
lines changed

1 file changed

+6
-6
lines changed

drivers/base/regmap/internal.h

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -73,12 +73,12 @@ struct regmap {
7373
void *bus_context;
7474
const char *name;
7575

76-
bool async;
7776
spinlock_t async_lock;
7877
wait_queue_head_t async_waitq;
7978
struct list_head async_list;
8079
struct list_head async_free;
8180
int async_ret;
81+
bool async;
8282

8383
#ifdef CONFIG_DEBUG_FS
8484
bool debugfs_disable;
@@ -117,8 +117,6 @@ struct regmap {
117117
void *val_buf, size_t val_size);
118118
int (*write)(void *context, const void *data, size_t count);
119119

120-
bool defer_caching;
121-
122120
unsigned long read_flag_mask;
123121
unsigned long write_flag_mask;
124122

@@ -127,6 +125,8 @@ struct regmap {
127125
int reg_stride;
128126
int reg_stride_order;
129127

128+
bool defer_caching;
129+
130130
/* If set, will always write field to HW. */
131131
bool force_write_field;
132132

@@ -161,6 +161,9 @@ struct regmap {
161161
struct reg_sequence *patch;
162162
int patch_regs;
163163

164+
/* if set, the regmap core can sleep */
165+
bool can_sleep;
166+
164167
/* if set, converts bulk read to single read */
165168
bool use_single_read;
166169
/* if set, converts bulk write to single write */
@@ -176,9 +179,6 @@ struct regmap {
176179
void *selector_work_buf; /* Scratch buffer used for selector */
177180

178181
struct hwspinlock *hwlock;
179-
180-
/* if set, the regmap core can sleep */
181-
bool can_sleep;
182182
};
183183

184184
struct regcache_ops {

0 commit comments

Comments
 (0)