diff mbox

common: re-arrange struct kernel_param fields

Message ID 56C18DFF02000078000D1E84@prv-mh.provo.novell.com (mailing list archive)
State New, archived
Headers show

Commit Message

Jan Beulich Feb. 15, 2016, 7:36 a.m. UTC
Even if placed in .init.* there's no reason to needlessly bloat the
binary due to padding fields the compiler needs to insert on 64-bit
architectures.

Signed-off-by: Jan Beulich <jbeulich@suse.com>
common: re-arrange struct kernel_param fields

Even if placed in .init.* there's no reason to needlessly bloat the
binary due to padding fields the compiler needs to insert on 64-bit
architectures.

Signed-off-by: Jan Beulich <jbeulich@suse.com>

--- a/xen/include/xen/init.h
+++ b/xen/include/xen/init.h
@@ -81,34 +81,35 @@ struct kernel_param {
         OPT_SIZE,
         OPT_CUSTOM
     } type;
-    void *var;
     unsigned int len;
+    void *var;
 };
 
 extern struct kernel_param __setup_start, __setup_end;
 
 #define __setup_str static __initdata __attribute__((__aligned__(1))) char
-#define __kparam static __initsetup struct kernel_param
+#define __kparam static __initsetup \
+    __attribute__((__aligned__(sizeof(void *)))) struct kernel_param
 
 #define custom_param(_name, _var) \
     __setup_str __setup_str_##_var[] = _name; \
-    __kparam __setup_##_var = { __setup_str_##_var, OPT_CUSTOM, _var, 0 }
+    __kparam __setup_##_var = { __setup_str_##_var, OPT_CUSTOM, 0, _var }
 #define boolean_param(_name, _var) \
     __setup_str __setup_str_##_var[] = _name; \
     __kparam __setup_##_var = \
-        { __setup_str_##_var, OPT_BOOL, &_var, sizeof(_var) }
+        { __setup_str_##_var, OPT_BOOL, sizeof(_var), &_var }
 #define integer_param(_name, _var) \
     __setup_str __setup_str_##_var[] = _name; \
     __kparam __setup_##_var = \
-        { __setup_str_##_var, OPT_UINT, &_var, sizeof(_var) }
+        { __setup_str_##_var, OPT_UINT, sizeof(_var), &_var }
 #define size_param(_name, _var) \
     __setup_str __setup_str_##_var[] = _name; \
     __kparam __setup_##_var = \
-        { __setup_str_##_var, OPT_SIZE, &_var, sizeof(_var) }
+        { __setup_str_##_var, OPT_SIZE, sizeof(_var), &_var }
 #define string_param(_name, _var) \
     __setup_str __setup_str_##_var[] = _name; \
     __kparam __setup_##_var = \
-        { __setup_str_##_var, OPT_STR, &_var, sizeof(_var) }
+        { __setup_str_##_var, OPT_STR, sizeof(_var), &_var }
 
 #endif /* __ASSEMBLY__ */

Comments

Andrew Cooper Feb. 15, 2016, 8:18 a.m. UTC | #1
On 15/02/2016 07:36, Jan Beulich wrote:
> Even if placed in .init.* there's no reason to needlessly bloat the
> binary due to padding fields the compiler needs to insert on 64-bit
> architectures.
>
> Signed-off-by: Jan Beulich <jbeulich@suse.com>

Reviewed-by: Andrew Cooper <andrew.cooper3@citrix.com>
diff mbox

Patch

--- a/xen/include/xen/init.h
+++ b/xen/include/xen/init.h
@@ -81,34 +81,35 @@  struct kernel_param {
         OPT_SIZE,
         OPT_CUSTOM
     } type;
-    void *var;
     unsigned int len;
+    void *var;
 };
 
 extern struct kernel_param __setup_start, __setup_end;
 
 #define __setup_str static __initdata __attribute__((__aligned__(1))) char
-#define __kparam static __initsetup struct kernel_param
+#define __kparam static __initsetup \
+    __attribute__((__aligned__(sizeof(void *)))) struct kernel_param
 
 #define custom_param(_name, _var) \
     __setup_str __setup_str_##_var[] = _name; \
-    __kparam __setup_##_var = { __setup_str_##_var, OPT_CUSTOM, _var, 0 }
+    __kparam __setup_##_var = { __setup_str_##_var, OPT_CUSTOM, 0, _var }
 #define boolean_param(_name, _var) \
     __setup_str __setup_str_##_var[] = _name; \
     __kparam __setup_##_var = \
-        { __setup_str_##_var, OPT_BOOL, &_var, sizeof(_var) }
+        { __setup_str_##_var, OPT_BOOL, sizeof(_var), &_var }
 #define integer_param(_name, _var) \
     __setup_str __setup_str_##_var[] = _name; \
     __kparam __setup_##_var = \
-        { __setup_str_##_var, OPT_UINT, &_var, sizeof(_var) }
+        { __setup_str_##_var, OPT_UINT, sizeof(_var), &_var }
 #define size_param(_name, _var) \
     __setup_str __setup_str_##_var[] = _name; \
     __kparam __setup_##_var = \
-        { __setup_str_##_var, OPT_SIZE, &_var, sizeof(_var) }
+        { __setup_str_##_var, OPT_SIZE, sizeof(_var), &_var }
 #define string_param(_name, _var) \
     __setup_str __setup_str_##_var[] = _name; \
     __kparam __setup_##_var = \
-        { __setup_str_##_var, OPT_STR, &_var, sizeof(_var) }
+        { __setup_str_##_var, OPT_STR, sizeof(_var), &_var }
 
 #endif /* __ASSEMBLY__ */