git: 6cc493c79d9b - main - mtx: remove stale commentary about inlined spinlock ops
- Go to: [ bottom of page ] [ top of archives ] [ this month ]
Date: Sat, 04 Oct 2025 02:23:11 UTC
The branch main has been updated by mjg:
URL: https://cgit.FreeBSD.org/src/commit/?id=6cc493c79d9b9f8318c87d3d6bfd225924cc933b
commit 6cc493c79d9b9f8318c87d3d6bfd225924cc933b
Author: Mateusz Guzik <mjg@FreeBSD.org>
AuthorDate: 2025-10-04 02:20:37 +0000
Commit: Mateusz Guzik <mjg@FreeBSD.org>
CommitDate: 2025-10-04 02:20:37 +0000
mtx: remove stale commentary about inlined spinlock ops
While both locking and unlocking a spinlock used to be inline, this
changed when spinlock_enter/spinlock_exit got introduced, defeating the
point of inlining them.
This either needs to have inlined spinlock enter/exit in place or have
mtx lock/unlock as function calls with the irq flags inlined in there.
Sponsored by: Rubicon Communications, LLC ("Netgate")
---
sys/sys/mutex.h | 16 ++++++++--------
1 file changed, 8 insertions(+), 8 deletions(-)
diff --git a/sys/sys/mutex.h b/sys/sys/mutex.h
index 08d4e2d28b33..b534a74626bc 100644
--- a/sys/sys/mutex.h
+++ b/sys/sys/mutex.h
@@ -246,10 +246,10 @@ void _thread_lock(struct thread *);
})
/*
- * Lock a spin mutex. For spinlocks, we handle recursion inline (it
- * turns out that function calls can be significantly expensive on
- * some architectures). Since spin locks are not _too_ common,
- * inlining this code is not too big a deal.
+ * Lock a spin mutex.
+ *
+ * FIXME: spinlock_enter is a function call, defeating the point of inlining in
+ * this.
*/
#ifdef SMP
#define __mtx_lock_spin(mp, tid, opts, file, line) __extension__ ({ \
@@ -317,10 +317,10 @@ void _thread_lock(struct thread *);
})
/*
- * Unlock a spin mutex. For spinlocks, we can handle everything
- * inline, as it's pretty simple and a function call would be too
- * expensive (at least on some architectures). Since spin locks are
- * not _too_ common, inlining this code is not too big a deal.
+ * Unlock a spin mutex.
+ *
+ * FIXME: spinlock_exit is a function call, defeating the point of inlining in
+ * this.
*
* Since we always perform a spinlock_enter() when attempting to acquire a
* spin lock, we need to always perform a matching spinlock_exit() when