From 71f31d784e1816a155cafbccf4b28291200097aa Mon Sep 17 00:00:00 2001 From: Mark Johnston Date: Wed, 27 Oct 2021 11:18:13 -0400 Subject: [PATCH] rmslock: Update td_locks during lock and unlock operations Reviewed by: mjg MFC after: 1 week Sponsored by: The FreeBSD Foundation Differential Revision: https://reviews.freebsd.org/D32692 --- sys/kern/kern_rmlock.c | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/sys/kern/kern_rmlock.c b/sys/kern/kern_rmlock.c index 7230a00e357b..f9b5559a648c 100644 --- a/sys/kern/kern_rmlock.c +++ b/sys/kern/kern_rmlock.c @@ -1017,6 +1017,7 @@ rms_rlock_fallback(struct rmslock *rms) rms_int_readers_inc(rms, rms_int_pcpu(rms)); mtx_unlock(&rms->mtx); critical_exit(); + TD_LOCKS_INC(curthread); } void @@ -1040,6 +1041,7 @@ rms_rlock(struct rmslock *rms) atomic_interrupt_fence(); rms_int_influx_exit(rms, pcpu); critical_exit(); + TD_LOCKS_INC(curthread); } int @@ -1063,6 +1065,7 @@ rms_try_rlock(struct rmslock *rms) atomic_interrupt_fence(); rms_int_influx_exit(rms, pcpu); critical_exit(); + TD_LOCKS_INC(curthread); return (1); } @@ -1082,6 +1085,7 @@ rms_runlock_fallback(struct rmslock *rms) if (rms->readers == 0) wakeup_one(&rms->writers); mtx_unlock(&rms->mtx); + TD_LOCKS_DEC(curthread); } void @@ -1102,6 +1106,7 @@ rms_runlock(struct rmslock *rms) atomic_interrupt_fence(); rms_int_influx_exit(rms, pcpu); critical_exit(); + TD_LOCKS_DEC(curthread); } struct rmslock_ipi { @@ -1219,6 +1224,7 @@ rms_wlock(struct rmslock *rms) rms_assert_no_pcpu_readers(rms); mtx_unlock(&rms->mtx); MPASS(rms->readers == 0); + TD_LOCKS_INC(curthread); } void @@ -1239,6 +1245,7 @@ rms_wunlock(struct rmslock *rms) rms->owner = RMS_NOOWNER; } mtx_unlock(&rms->mtx); + TD_LOCKS_DEC(curthread); } void