aboutsummaryrefslogtreecommitdiff
path: root/sys/sys
diff options
context:
space:
mode:
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
parentcc743b050acf59862b268296d50923d6e5f0e86f (diff)
downloadsrc-eac22dd48079d5cccecb07f4e60b44bb692167f8.tar.gz
src-eac22dd48079d5cccecb07f4e60b44bb692167f8.zip
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')
-rw-r--r--sys/sys/_lockmgr.h4
-rw-r--r--sys/sys/param.h7
2 files changed, 6 insertions, 5 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;
#ifdef DEBUG_LOCKS
struct stack lk_stack;
#endif
diff --git a/sys/sys/param.h b/sys/sys/param.h
index 058aef99e077..fa02b55d1f1b 100644
--- a/sys/sys/param.h
+++ b/sys/sys/param.h
@@ -227,9 +227,10 @@
((off_t)(db) << DEV_BSHIFT)
#endif
-#define PRIMASK 0x0ff
-#define PCATCH 0x100 /* OR'd with pri for tsleep to check signals */
-#define PDROP 0x200 /* OR'd with pri to stop re-entry of interlock mutex */
+#define PRIMASK 0x0ff
+#define PCATCH 0x100 /* OR'd with pri for tsleep to check signals */
+#define PDROP 0x200 /* OR'd with pri to stop re-entry of interlock mutex */
+#define PRILASTFLAG 0x200 /* Last flag defined above */
#define NZERO 0 /* default "nice" */