Re: [PATCH v3] locking/local_lock, mm: Replace localtry_ helpers with local_trylock_t type
From: Andrew Morton
Date: Wed Apr 02 2025 - 23:13:07 EST
On Wed, 2 Apr 2025 19:55:14 -0700 Alexei Starovoitov <alexei.starovoitov@xxxxxxxxx> wrote:
> Partially revert commit 0aaddfb06882 ("locking/local_lock: Introduce localtry_lock_t").
> Remove localtry_*() helpers, since localtry_lock() name might
> be misinterpreted as "try lock".
>
So many macros grumble.
+#define local_trylock_init(lock) __local_trylock_init(lock)
+#define local_trylock(lock) __local_trylock(lock)
+#define local_trylock_irqsave(lock, flags) \
+#define __local_trylock_init(lock) __local_lock_init(lock.llock)
+#define __local_lock_acquire(lock) \
+#define __local_trylock(lock) \
+#define __local_trylock_irqsave(lock, flags) \
+#define __local_lock_release(lock) \
+#define __local_unlock(lock) \
+#define __local_unlock_irq(lock) \
+#define __local_unlock_irqrestore(lock, flags) \
+#define __local_lock_nested_bh(lock) \
+#define __local_unlock_nested_bh(lock) \
+#define __local_trylock_init(l) __local_lock_init(l)
+#define __local_trylock(lock) \
+#define __local_trylock_irqsave(lock, flags) \
I expect many of these could have been implemented as static inlines.
Oh well, that's a separate project for someone sometime.