path: root/sys/sys/_lockmgr.h
diff options
authorMateusz Guzik <mjg@FreeBSD.org>2021-02-15 04:24:17 +0000
committerMateusz Guzik <mjg@FreeBSD.org>2021-02-15 13:57:25 +0000
commiteac22dd48079d5cccecb07f4e60b44bb692167f8 (patch)
tree20a17b60a1464eebb283adf35405e2c433d93c11 /sys/sys/_lockmgr.h
parentcc743b050acf59862b268296d50923d6e5f0e86f (diff)
lockmgr: shrink struct lock by 8 bytes on LP64
Currently the struct has a 4 byte padding stemming from 3 ints. 1. prio comfortably fits in short, unfortunately there is no dedicated type for it and plumbing it throughout the codebase is not worth it right now, instead an assert is added which covers also flags for safety 2. lk_exslpfail can in principle exceed u_short, but the count is already not considered reliable and it only ever gets modified straight to 0. In other words it can be incrementing with an upper bound of USHRT_MAX With these in place struct lock shrinks from 48 to 40 bytes. Reviewed by: kib (previous version) Differential Revision: https://reviews.freebsd.org/D28680
Diffstat (limited to 'sys/sys/_lockmgr.h')
1 files changed, 2 insertions, 2 deletions
diff --git a/sys/sys/_lockmgr.h b/sys/sys/_lockmgr.h
index 62e50df1ac4e..b0d164bdb4dc 100644
--- a/sys/sys/_lockmgr.h
+++ b/sys/sys/_lockmgr.h
@@ -40,9 +40,9 @@
struct lock {
struct lock_object lock_object;
volatile uintptr_t lk_lock;
- u_int lk_exslpfail;
+ u_short lk_exslpfail;
+ u_short lk_pri;
int lk_timo;
- int lk_pri;
struct stack lk_stack;