From: Christophe JAILLET Date: Sat, 8 Jul 2023 10:13:45 +0000 (+0200) Subject: kobject: Reorder fields in 'struct kobject' X-Git-Url: http://git.maquefel.me/?a=commitdiff_plain;h=f5992717b5826debc4aa58d4da6233563b139320;p=linux.git kobject: Reorder fields in 'struct kobject' Group some variables based on their sizes to reduce hole and avoid padding. On x86_64, this shrinks the size of 'struct kobject' from 256 to 244 bytes. This structure is often included in some other structures. So these other structures will also benefit from this 8 bytes saving. This is especially nice for structure like 'cma_kobject' or 'class_dir' that are now 256 bytes long. When they are kzalloc()'ed, 256 bytes are allocated, instead of 512. Signed-off-by: Christophe JAILLET Link: https://lore.kernel.org/r/6c7d1e3005dbec5483bdb9b7b60071175bf7bf70.1688811201.git.christophe.jaillet@wanadoo.fr Signed-off-by: Greg Kroah-Hartman --- diff --git a/include/linux/kobject.h b/include/linux/kobject.h index c392c811d9ad9..c30affcc43b44 100644 --- a/include/linux/kobject.h +++ b/include/linux/kobject.h @@ -69,14 +69,16 @@ struct kobject { const struct kobj_type *ktype; struct kernfs_node *sd; /* sysfs directory entry */ struct kref kref; -#ifdef CONFIG_DEBUG_KOBJECT_RELEASE - struct delayed_work release; -#endif + unsigned int state_initialized:1; unsigned int state_in_sysfs:1; unsigned int state_add_uevent_sent:1; unsigned int state_remove_uevent_sent:1; unsigned int uevent_suppress:1; + +#ifdef CONFIG_DEBUG_KOBJECT_RELEASE + struct delayed_work release; +#endif }; __printf(2, 3) int kobject_set_name(struct kobject *kobj, const char *name, ...);