aboutsummaryrefslogtreecommitdiff
path: root/sys/sys/_rmlock.h
diff options
context:
space:
mode:
authorMateusz Guzik <mjg@FreeBSD.org>2020-11-07 16:57:53 +0000
committerMateusz Guzik <mjg@FreeBSD.org>2020-11-07 16:57:53 +0000
commit42e7abd5db3ee5c9d9c37c0645fb3a880a701314 (patch)
treed14544e61a486196f0f64333fd8a22b21dd8e80c /sys/sys/_rmlock.h
parentecb4fdf943ca2ffa78b2564c40d27a4eea5da0da (diff)
downloadsrc-42e7abd5db3ee5c9d9c37c0645fb3a880a701314.tar.gz
src-42e7abd5db3ee5c9d9c37c0645fb3a880a701314.zip
rms: several cleanups + debug read lockers handling
This adds a dedicated counter updated with atomics when INVARIANTS is used. As a side effect one can reliably determine the lock is held for reading by at least one thread, but it's still not possible to find out whether curthread has the lock in said mode. This should be good enough in practice. Problem spotted by avg.
Notes
Notes: svn path=/head/; revision=367453
Diffstat (limited to 'sys/sys/_rmlock.h')
-rw-r--r--sys/sys/_rmlock.h6
1 files changed, 4 insertions, 2 deletions
diff --git a/sys/sys/_rmlock.h b/sys/sys/_rmlock.h
index e153130c4e75..8bf5be57343c 100644
--- a/sys/sys/_rmlock.h
+++ b/sys/sys/_rmlock.h
@@ -70,13 +70,15 @@ struct rm_priotracker {
#include <sys/_mutex.h>
+struct rmslock_pcpu;
+
struct rmslock {
struct mtx mtx;
struct thread *owner;
+ struct rmslock_pcpu *pcpu;
int writers;
int readers;
- int *readers_pcpu;
- int *readers_influx;
+ int debug_readers;
};
#endif /* !_SYS__RMLOCK_H_ */