aboutsummaryrefslogtreecommitdiff
path: root/sys/kern/subr_lock.c
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/kern/subr_lock.c
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/kern/subr_lock.c')
-rw-r--r--sys/kern/subr_lock.c1
1 files changed, 1 insertions, 0 deletions
diff --git a/sys/kern/subr_lock.c b/sys/kern/subr_lock.c
index b69ee349482c..a74f7e62db4a 100644
--- a/sys/kern/subr_lock.c
+++ b/sys/kern/subr_lock.c
@@ -40,6 +40,7 @@ __FBSDID("$FreeBSD$");
#include <sys/systm.h>
#include <sys/kernel.h>
#include <sys/ktr.h>
+#include <sys/limits.h>
#include <sys/lock.h>
#include <sys/lock_profile.h>
#include <sys/malloc.h>