Skip to content

Commit

Permalink
module: reorder kparam_array to remove alignment padding on 64 bit bu…
Browse files Browse the repository at this point in the history
…ilds

Reorder structure kparam_array to remove 8 bytes of alignment padding on
64 bit builds, dropping its size from 40 to 32 bytes.

Also update the macro module_param_array_named to initialise the
structure using its member names to allow it to be changed without
touching all its call sites.

'git grep' finds module_param_array in 1037 places so this patch will
save a small amount of data space across many modules.

Signed-off-by: Richard Kennedy <richard@rsk.demon.co.uk>
Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>
  • Loading branch information
Richard Kennedy authored and Rusty Russell committed May 19, 2011
1 parent a288bd6 commit c5be0b2
Showing 1 changed file with 4 additions and 3 deletions.
7 changes: 4 additions & 3 deletions include/linux/moduleparam.h
Original file line number Diff line number Diff line change
Expand Up @@ -67,9 +67,9 @@ struct kparam_string {
struct kparam_array
{
unsigned int max;
unsigned int elemsize;
unsigned int *num;
const struct kernel_param_ops *ops;
unsigned int elemsize;
void *elem;
};

Expand Down Expand Up @@ -371,8 +371,9 @@ extern int param_get_invbool(char *buffer, const struct kernel_param *kp);
*/
#define module_param_array_named(name, array, type, nump, perm) \
static const struct kparam_array __param_arr_##name \
= { ARRAY_SIZE(array), nump, &param_ops_##type, \
sizeof(array[0]), array }; \
= { .max = ARRAY_SIZE(array), .num = nump, \
.ops = &param_ops_##type, \
.elemsize = sizeof(array[0]), .elem = array }; \
__module_param_call(MODULE_PARAM_PREFIX, name, \
&param_array_ops, \
.arr = &__param_arr_##name, \
Expand Down

0 comments on commit c5be0b2

Please sign in to comment.