summaryrefslogtreecommitdiff
path: root/kernel/locking/mutex.h
diff options
context:
space:
mode:
authorJohn Stultz <jstultz@google.com>2026-03-24 19:13:19 +0000
committerPeter Zijlstra <peterz@infradead.org>2026-04-03 14:23:39 +0200
commitfa4a1ff8ab235a308d8c983827657a69649185fd (patch)
tree832bd48a7c5f4e55fa33a3ffee76facc978838d5 /kernel/locking/mutex.h
parentf4fe6be82e6d27349de66a42d6d1b2b11dc97a14 (diff)
locking: Add task::blocked_lock to serialize blocked_on state
So far, we have been able to utilize the mutex::wait_lock for serializing the blocked_on state, but when we move to proxying across runqueues, we will need to add more state and a way to serialize changes to this state in contexts where we don't hold the mutex::wait_lock. So introduce the task::blocked_lock, which nests under the mutex::wait_lock in the locking order, and rework the locking to use it. Signed-off-by: John Stultz <jstultz@google.com> Signed-off-by: Peter Zijlstra (Intel) <peterz@infradead.org> Reviewed-by: K Prateek Nayak <kprateek.nayak@amd.com> Link: https://patch.msgid.link/20260324191337.1841376-5-jstultz@google.com
Diffstat (limited to 'kernel/locking/mutex.h')
-rw-r--r--kernel/locking/mutex.h6
1 files changed, 6 insertions, 0 deletions
diff --git a/kernel/locking/mutex.h b/kernel/locking/mutex.h
index 9ad4da8cea00..7a8ba13fee94 100644
--- a/kernel/locking/mutex.h
+++ b/kernel/locking/mutex.h
@@ -47,6 +47,12 @@ static inline struct task_struct *__mutex_owner(struct mutex *lock)
return (struct task_struct *)(atomic_long_read(&lock->owner) & ~MUTEX_FLAGS);
}
+static inline struct mutex *get_task_blocked_on(struct task_struct *p)
+{
+ guard(raw_spinlock_irqsave)(&p->blocked_lock);
+ return __get_task_blocked_on(p);
+}
+
#ifdef CONFIG_DEBUG_MUTEXES
extern void debug_mutex_lock_common(struct mutex *lock,
struct mutex_waiter *waiter);