From 7d455d64ca8c4d425469581d694b46ae7a87efb2 Mon Sep 17 00:00:00 2001 From: Maria Matejka Date: Tue, 25 Jun 2024 15:48:11 +0200 Subject: [PATCH] Remove spinlock debug structures in production build --- lib/locking.h | 2 +- sysdep/unix/domain.c | 2 ++ 2 files changed, 3 insertions(+), 1 deletion(-) diff --git a/lib/locking.h b/lib/locking.h index 71277827..30450535 100644 --- a/lib/locking.h +++ b/lib/locking.h @@ -107,6 +107,7 @@ typedef struct { u64 _Atomic spin; } rw_spinlock; +#ifdef DEBUGGING #define MAX_RWS_AT_ONCE 32 extern _Thread_local rw_spinlock *rw_spinlocks_taken[MAX_RWS_AT_ONCE]; extern _Thread_local btime rw_spinlocks_time[MAX_RWS_AT_ONCE]; @@ -116,7 +117,6 @@ extern _Thread_local u32 rw_spinlocks_taken_write; /* Borrowed from lib/timer.h */ btime current_time_now(void); -#ifdef DEBUGGING static inline void rws_mark(rw_spinlock *p, _Bool write, _Bool lock) { if (lock) { diff --git a/sysdep/unix/domain.c b/sysdep/unix/domain.c index 4e6d8a61..7dace7e1 100644 --- a/sysdep/unix/domain.c +++ b/sysdep/unix/domain.c @@ -35,10 +35,12 @@ * Locking subsystem */ +#ifdef DEBUGGING _Thread_local rw_spinlock *rw_spinlocks_taken[MAX_RWS_AT_ONCE]; _Thread_local btime rw_spinlocks_time[MAX_RWS_AT_ONCE]; _Thread_local u32 rw_spinlocks_taken_cnt; _Thread_local u32 rw_spinlocks_taken_write; +#endif _Thread_local struct lock_order locking_stack = {}; _Thread_local struct domain_generic **last_locked = NULL;