kernel: Rewrite B_DEBUG_SPINLOCK_CONTENTION.
* Replace count_low/count_high with bigtime_t fields plus an int32. sizeof(spinlock) is now 32 bytes with the debug option enabled. * Adjust and clean up all spinlock code to use the new fields. * Fold DEBUG_SPINLOCK_LATENCIES into the new code. Remove the bootloader option and other flags for it (these were not compiled in by default.) The new code should be much easier to understand and also more powerful. However, the information transmitted to userland isn't as useful now; the KDL command output will have the interesting information. (Things could be reworked to transmit more interesting information to userland again if desired, but as this code clearly hadn't been compiled for many years, as it referred to global spinlocks that have been gone for a very long time.) Change-Id: I2cb34078bfdc7604f288a297b6cd1aa7ff9cc512 Reviewed-on: https://review.haiku-os.org/c/haiku/+/6943 Reviewed-by: waddlesplash <[email protected]> Tested-by: Commit checker robot <[email protected]>
This commit is contained in:
committed by
waddlesplash
parent
ef9e2f627b
commit
76681bd900
@@ -21,15 +21,19 @@ typedef ulong cpu_status;
|
||||
#if B_DEBUG_SPINLOCK_CONTENTION
|
||||
typedef struct {
|
||||
int32 lock;
|
||||
int32 count_low;
|
||||
int32 count_high;
|
||||
int32 failed_try_acquire;
|
||||
bigtime_t total_wait;
|
||||
bigtime_t total_held;
|
||||
bigtime_t last_acquired;
|
||||
} spinlock;
|
||||
|
||||
# define B_SPINLOCK_INITIALIZER { 0, 0, 0 }
|
||||
# define B_SPINLOCK_INITIALIZER { 0, 0, 0, 0, 0 }
|
||||
# define B_INITIALIZE_SPINLOCK(spinlock) do { \
|
||||
(spinlock)->lock = 0; \
|
||||
(spinlock)->count_low = 0; \
|
||||
(spinlock)->count_high = 0; \
|
||||
(spinlock)->failed_try_acquire = 0; \
|
||||
(spinlock)->total_wait = 0; \
|
||||
(spinlock)->total_held = 0; \
|
||||
(spinlock)->last_acquired = 0; \
|
||||
} while (false)
|
||||
#else
|
||||
typedef struct {
|
||||
|
||||
Reference in New Issue
Block a user