summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorIan Moffett <ian@osmora.org>2025-08-20 01:07:32 -0400
committerIan Moffett <ian@osmora.org>2025-08-20 01:07:32 -0400
commit01892b6aa5f68b8e4db69bd76e60496320e6108f (patch)
tree053d6e56d88c7cb229d1a5026cf6a6c1a586136c
parentc921000af6782a6a35da8e3b3482b3737c49ac23 (diff)
kernel: synch: Deprecate global __syslock
The global spinlock is highly contentious and can be a great performance bottleneck in SMP systems. Use of such mechanisms are discouraged. Signed-off-by: Ian Moffett <ian@osmora.org>
-rw-r--r--sys/include/sys/spinlock.h3
-rw-r--r--sys/kern/kern_synch.c26
2 files changed, 0 insertions, 29 deletions
diff --git a/sys/include/sys/spinlock.h b/sys/include/sys/spinlock.h
index 140addc..b416152 100644
--- a/sys/include/sys/spinlock.h
+++ b/sys/include/sys/spinlock.h
@@ -44,9 +44,6 @@ void spinlock_release(struct spinlock *lock);
int spinlock_try_acquire(struct spinlock *lock);
int spinlock_usleep(struct spinlock *lock, size_t usec_max);
-/* System-wide locking (be careful!!) */
-int syslock(void);
-void sysrel(void);
#endif
#endif /* !_SYS_SPINLOCK_H_ */
diff --git a/sys/kern/kern_synch.c b/sys/kern/kern_synch.c
index 3fe6047..7660f1f 100644
--- a/sys/kern/kern_synch.c
+++ b/sys/kern/kern_synch.c
@@ -42,9 +42,6 @@
#define pr_trace(fmt, ...) kprintf("synch: " fmt, ##__VA_ARGS__)
#define pr_error(...) pr_trace(__VA_ARGS__)
-/* XXX: Be very careful with this */
-static struct spinlock __syslock;
-
/*
* Returns 0 on success, returns non-zero value
* on timeout/failure.
@@ -122,29 +119,6 @@ spinlock_release(struct spinlock *lock)
}
/*
- * Attempt to hold the system-wide lock, returns 1
- * if already held.
- *
- * XXX: Only use for CRITICAL code sections.
- */
-int
-syslock(void)
-{
- return spinlock_try_acquire(&__syslock);
-}
-
-/*
- * Release the system-wide lock
- *
- * XXX: Only use for CRITICAL code sections.
- */
-void
-sysrel(void)
-{
- spinlock_release(&__syslock);
-}
-
-/*
* Create a new mutex lock object
*/
struct mutex *