Skip to content

Commit 973c81c

Browse files
committed
CLEANUP: tinfo: move sched_*_date/*_mono_time to the thread-local area
These ones are never atomically accessed, they have nothing to do in the atomic ops cache line, let's move them to the thread-local area.
1 parent 8dc68f3 commit 973c81c

File tree

1 file changed

+11
-7
lines changed

1 file changed

+11
-7
lines changed

include/haproxy/tinfo-t.h

Lines changed: 11 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -152,7 +152,16 @@ struct thread_ctx {
152152

153153
void **emergency_bufs; /* array of buffers allocated at boot. Next free one is [emergency_bufs_left-1] */
154154
uint emergency_bufs_left; /* number of emergency buffers left in magic_bufs[] */
155-
// around 36 bytes here for thread-local variables
155+
156+
uint32_t sched_wake_date; /* current task/tasklet's wake date in 32-bit ns or 0 if not supported */
157+
uint32_t sched_call_date; /* current task/tasklet's call date in 32-bit ns */
158+
159+
// 4 bytes hole here
160+
161+
uint64_t prev_mono_time; /* previous system wide monotonic time (leaving poll) */
162+
uint64_t curr_mono_time; /* latest system wide monotonic time (leaving poll) */
163+
164+
// around 8 bytes here for thread-local variables
156165

157166
// third cache line here on 64 bits: accessed mostly using atomic ops
158167
ALWAYS_ALIGN(64);
@@ -164,12 +173,7 @@ struct thread_ctx {
164173
uint flags; /* thread flags, TH_FL_*, atomic! */
165174
uint active_checks; /* number of active health checks on this thread, incl migrated */
166175

167-
uint32_t sched_wake_date; /* current task/tasklet's wake date or 0 */
168-
uint32_t sched_call_date; /* current task/tasklet's call date (valid if sched_wake_date > 0) */
169-
170176
uint64_t prev_cpu_time; /* previous per thread CPU time */
171-
uint64_t prev_mono_time; /* previous system wide monotonic time */
172-
uint64_t curr_mono_time; /* latest system wide monotonic time */
173177

174178
struct eb_root rqueue_shared; /* run queue fed by other threads */
175179
__decl_thread(HA_SPINLOCK_T rqsh_lock); /* lock protecting the shared runqueue */
@@ -183,7 +187,7 @@ struct thread_ctx {
183187
unsigned long long total_streams; /* Total number of streams created on this thread */
184188
unsigned int stream_cnt; /* Number of streams attached to this thread */
185189

186-
// around 44 bytes here for shared variables
190+
// around 68 bytes here for shared variables
187191

188192
ALWAYS_ALIGN(128);
189193
};

0 commit comments

Comments
 (0)