Skip to contentSkip to conversation

locking/mutex: define conditional guard for for mutex_lock_killable()

PATCH New Carlos López 1 participant 1 message Dec 19, 2025 Locking primitives

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 locking/mutex: define conditional guard for for mutex_lock_killable()

Allow using guards with mutex_lock_killable(), just like we currently do with mutex_lock_interruptable(), e.g.

    scoped_guard(mutex_killable, &my_mutex) {
        ...
    }
---
 include/linux/mutex.h | 1 +
 1 file changed, 1 insertion(+)
include/linux/mutex.h +1 -0
index bf535f0118bb..931a139e6176 100644
@@ -253,6 +253,7 @@ extern int atomic_dec_and_mutex_lock(atomic_t *cnt, struct mutex *lock);
 DEFINE_GUARD(mutex, struct mutex *, mutex_lock(_T), mutex_unlock(_T))
 DEFINE_GUARD_COND(mutex, _try, mutex_trylock(_T))
 DEFINE_GUARD_COND(mutex, _intr, mutex_lock_interruptible(_T), _RET == 0)
+DEFINE_GUARD_COND(mutex, _killable, mutex_lock_killable(_T), _RET == 0)
 
 extern unsigned long mutex_get_owner(struct mutex *lock);
 
Signature · 1 line
2.51.0