From: Zbigniew Jędrzejewski-Szmek Date: Tue, 9 Feb 2021 18:51:50 +0000 (+0100) Subject: sd-netlink: pahole optimization of sd_netlink_slot X-Git-Tag: v248-rc1~166^2~8 X-Git-Url: http://git.ipfire.org/gitweb.cgi?a=commitdiff_plain;h=399f74c79d27e06f22908bfbffbb28e207f5810b;p=thirdparty%2Fsystemd.git sd-netlink: pahole optimization of sd_netlink_slot By rearranging the fields, we can avoid one of the holes (on amd64). By adding more space for .type, -EINVAL can be used as a value later on. The structure is reduced from 96 to 88 bytes (on amd64). Text size is also smaller: -rwxrwxr-x 1 zbyszek zbyszek 4109832 Feb 9 19:50 build/libsystemd.so.0.30.0 -rwxrwxr-x 1 zbyszek zbyszek 4109792 Feb 9 19:51 build/libsystemd.so.0.30.0 --- diff --git a/src/libsystemd/sd-netlink/netlink-internal.h b/src/libsystemd/sd-netlink/netlink-internal.h index efd0cf93358..9159f94dd9a 100644 --- a/src/libsystemd/sd-netlink/netlink-internal.h +++ b/src/libsystemd/sd-netlink/netlink-internal.h @@ -38,12 +38,12 @@ typedef enum NetlinkSlotType { struct sd_netlink_slot { unsigned n_ref; + NetlinkSlotType type:8; + bool floating; sd_netlink *netlink; void *userdata; sd_netlink_destroy_t destroy_callback; - NetlinkSlotType type:2; - bool floating:1; char *description; LIST_FIELDS(sd_netlink_slot, slots);