From: "Carlos López" <clopez@suse.de>
To: linux-kernel@vger.kernel.org
Cc: "Carlos López" <clopez@suse.de>,
"Peter Zijlstra" <peterz@infradead.org>,
"Ingo Molnar" <mingo@redhat.com>, "Will Deacon" <will@kernel.org>,
"Boqun Feng" <boqun.feng@gmail.com>,
"Waiman Long" <longman@redhat.com>
Subject: [PATCH] locking/mutex: define conditional guard for for mutex_lock_killable()
Date: Fri, 19 Dec 2025 16:25:49 +0100 [thread overview]
Message-ID: <20251219152548.3861707-2-clopez@suse.de> (raw)
Allow using guards with mutex_lock_killable(), just like we currently do
with mutex_lock_interruptable(), e.g.
scoped_guard(mutex_killable, &my_mutex) {
...
}
Signed-off-by: Carlos López <clopez@suse.de>
---
include/linux/mutex.h | 1 +
1 file changed, 1 insertion(+)
diff --git a/include/linux/mutex.h b/include/linux/mutex.h
index bf535f0118bb..931a139e6176 100644
--- a/include/linux/mutex.h
+++ b/include/linux/mutex.h
@@ -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);
--
2.51.0
reply other threads:[~2025-12-19 15:28 UTC|newest]
Thread overview: [no followups] expand[flat|nested] mbox.gz Atom feed
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20251219152548.3861707-2-clopez@suse.de \
--to=clopez@suse.de \
--cc=boqun.feng@gmail.com \
--cc=linux-kernel@vger.kernel.org \
--cc=longman@redhat.com \
--cc=mingo@redhat.com \
--cc=peterz@infradead.org \
--cc=will@kernel.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox
all inboxes | Powered by JetHome®