* [PATCH] module: reorder kparam_array to remove alignment padding on 64 bit builds
@ 2011-02-23 17:14 Richard Kennedy
0 siblings, 0 replies; only message in thread
From: Richard Kennedy @ 2011-02-23 17:14 UTC (permalink / raw)
To: Rusty Russell; +Cc: lkml
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>
----
patch against v2.6.38-rc6
compiled & tested on x86_64
regards
Richard
diff --git a/include/linux/moduleparam.h b/include/linux/moduleparam.h
index 07b4195..ddaae98 100644
--- a/include/linux/moduleparam.h
+++ b/include/linux/moduleparam.h
@@ -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;
};
@@ -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, ¶m_ops_##type, \
- sizeof(array[0]), array }; \
+ = { .max = ARRAY_SIZE(array), .num = nump, \
+ .ops = ¶m_ops_##type, \
+ .elemsize = sizeof(array[0]), .elem = array }; \
__module_param_call(MODULE_PARAM_PREFIX, name, \
¶m_array_ops, \
.arr = &__param_arr_##name, \
^ permalink raw reply [flat|nested] only message in thread
only message in thread, other threads:[~2011-02-23 17:15 UTC | newest]
Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2011-02-23 17:14 [PATCH] module: reorder kparam_array to remove alignment padding on 64 bit builds Richard Kennedy
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox
all inboxes | Powered by JetHome®