From 8c2524c7fdb46d801594030504c6059afcde89fa Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Zbigniew=20J=C4=99drzejewski-Szmek?= Date: Wed, 10 Feb 2021 17:32:31 +0100 Subject: [PATCH] core: pahole optimization of struct Unit We had a lone 'bool job_running_timeout_set:1', which generated a hole. Let's move things around a bit. The structure is a tiny bit smaller and has less holes: /* size: 1192, cachelines: 19, members: 149 */ /* sum members: 1175, holes: 3, sum holes: 11 */ /* sum bitfield members: 27 bits, bit holes: 1, sum bit holes: 7 bits */ /* bit_padding: 14 bits */ /* last cacheline: 40 bytes */ /* size: 1184, cachelines: 19, members: 149 */ /* sum members: 1175, holes: 1, sum holes: 4 */ /* sum bitfield members: 27 bits (3 bytes) */ /* bit_padding: 13 bits */ /* last cacheline: 32 bytes */ --- src/core/unit.h | 22 ++++++++++++---------- 1 file changed, 12 insertions(+), 10 deletions(-) diff --git a/src/core/unit.h b/src/core/unit.h index 1af0e50312..457eba44a1 100644 --- a/src/core/unit.h +++ b/src/core/unit.h @@ -120,9 +120,6 @@ typedef struct Unit { UnitLoadState load_state; Unit *merged_into; - FreezerState freezer_state; - sd_bus_message *pending_freezer_message; - char *id; /* The one special name that we use for identification */ char *instance; @@ -150,6 +147,16 @@ typedef struct Unit { /* If this is a transient unit we are currently writing, this is where we are writing it to */ FILE *transient_file; + /* Freezer state */ + sd_bus_message *pending_freezer_message; + FreezerState freezer_state; + + /* Job timeout and action to take */ + EmergencyAction job_timeout_action; + usec_t job_timeout; + usec_t job_running_timeout; + char *job_timeout_reboot_arg; + /* If there is something to do with this unit, then this is the installed job for it */ Job *job; @@ -164,13 +171,6 @@ typedef struct Unit { sd_bus_track *bus_track; char **deserialized_refs; - /* Job timeout and action to take */ - usec_t job_timeout; - usec_t job_running_timeout; - bool job_running_timeout_set:1; - EmergencyAction job_timeout_action; - char *job_timeout_reboot_arg; - /* References to this */ LIST_HEAD(UnitRef, refs_by_target); @@ -359,6 +359,8 @@ typedef struct Unit { bool sent_dbus_new_signal:1; + bool job_running_timeout_set:1; + bool in_audit:1; bool on_console:1;