summaryrefslogtreecommitdiffstats
path: root/sys/kern/kern_sx.c
diff options
context:
space:
mode:
authorjhb <jhb@FreeBSD.org>2006-01-06 18:07:32 +0000
committerjhb <jhb@FreeBSD.org>2006-01-06 18:07:32 +0000
commit8f18f21de1bd66b7ee393a6c26e6b404214128d5 (patch)
tree79baaa91275592f61e12702cac7c092b2d2d4074 /sys/kern/kern_sx.c
parentb183f7d5ee2596f436239b4b518900baf2efa962 (diff)
downloadFreeBSD-src-8f18f21de1bd66b7ee393a6c26e6b404214128d5.zip
FreeBSD-src-8f18f21de1bd66b7ee393a6c26e6b404214128d5.tar.gz
Trim another pointer from struct lock_object (and thus from struct mtx and
struct sx). Instead of storing a direct pointer to a our lock_class struct in lock_object, reserve 4 bits in the lo_flags field to serve as an index into a global lock_classes array that contains pointers to the lock classes. Only debugging code such as WITNESS or INVARIANTS checks and KTR logging need to access the lock_class member, so this shouldn't add any overhead to production kernels. It might add some slight overhead to kernels using those debug options however. As with the previous set of changes to lock_object, this is going to completely obliterate the kernel ABI, so be sure to recompile all your modules.
Diffstat (limited to 'sys/kern/kern_sx.c')
-rw-r--r--sys/kern/kern_sx.c4
1 files changed, 2 insertions, 2 deletions
diff --git a/sys/kern/kern_sx.c b/sys/kern/kern_sx.c
index 7a14de0..d24e4de 100644
--- a/sys/kern/kern_sx.c
+++ b/sys/kern/kern_sx.c
@@ -83,9 +83,9 @@ sx_init(struct sx *sx, const char *description)
KASSERT((lock->lo_flags & LO_INITIALIZED) == 0,
("sx lock %s %p already initialized", description, sx));
bzero(sx, sizeof(*sx));
- lock->lo_class = &lock_class_sx;
+ lock->lo_flags = LOCK_CLASS_SX << LO_CLASSSHIFT;
lock->lo_type = lock->lo_name = description;
- lock->lo_flags = LO_WITNESS | LO_RECURSABLE | LO_SLEEPABLE |
+ lock->lo_flags |= LO_WITNESS | LO_RECURSABLE | LO_SLEEPABLE |
LO_UPGRADABLE;
sx->sx_lock = mtx_pool_find(mtxpool_lockbuilder, sx);
sx->sx_cnt = 0;
OpenPOWER on IntegriCloud