aboutsummaryrefslogtreecommitdiff
path: root/sys/sys/_rmlock.h
diff options
context:
space:
mode:
authorMateusz Guzik <mjg@FreeBSD.org>2020-11-04 21:18:08 +0000
committerMateusz Guzik <mjg@FreeBSD.org>2020-11-04 21:18:08 +0000
commit6fc2b069ca0a5604a06dcf189fd74fc0c323f707 (patch)
treeb2330b2abb2dd2a071b3d7bca80c150d31ab29f5 /sys/sys/_rmlock.h
parent4e306624d1e47f7ace600fea24486b378d07aaf5 (diff)
downloadsrc-6fc2b069ca0a5604a06dcf189fd74fc0c323f707.tar.gz
src-6fc2b069ca0a5604a06dcf189fd74fc0c323f707.zip
rms: fixup concurrent writer handling and add more features
Previously the code had one wait channel for all pending writers. This could result in a buggy scenario where after a writer switches the lock mode form readers to writers goes off CPU, another writer queues itself and then the last reader wakes up the latter instead of the former. Use a separate channel. While here add features to reliably detect whether curthread has the lock write-owned. This will be used by ZFS.
Notes
Notes: svn path=/head/; revision=367341
Diffstat (limited to 'sys/sys/_rmlock.h')
-rw-r--r--sys/sys/_rmlock.h1
1 files changed, 1 insertions, 0 deletions
diff --git a/sys/sys/_rmlock.h b/sys/sys/_rmlock.h
index 68ddc3b3fb03..e153130c4e75 100644
--- a/sys/sys/_rmlock.h
+++ b/sys/sys/_rmlock.h
@@ -72,6 +72,7 @@ struct rm_priotracker {
struct rmslock {
struct mtx mtx;
+ struct thread *owner;
int writers;
int readers;
int *readers_pcpu;