diff options
author | Sebastian Andrzej Siewior <bigeasy@linutronix.de> | 2023-09-08 18:22:52 +0200 |
---|---|---|
committer | Peter Zijlstra <peterz@infradead.org> | 2023-09-20 09:31:13 +0200 |
commit | d14f9e930b9073de264c106bf04968286ef9b3a4 (patch) | |
tree | 2acd6250e7e5e8a097ddf0bae27ab6e87756568e /kernel/futex | |
parent | sched: Provide rt_mutex specific scheduler helpers (diff) | |
download | linux-d14f9e930b9073de264c106bf04968286ef9b3a4.tar.xz linux-d14f9e930b9073de264c106bf04968286ef9b3a4.zip |
locking/rtmutex: Use rt_mutex specific scheduler helpers
Have rt_mutex use the rt_mutex specific scheduler helpers to avoid
recursion vs rtlock on the PI state.
[[ peterz: adapted to new names ]]
Reported-by: Crystal Wood <swood@redhat.com>
Signed-off-by: Sebastian Andrzej Siewior <bigeasy@linutronix.de>
Signed-off-by: Peter Zijlstra (Intel) <peterz@infradead.org>
Link: https://lkml.kernel.org/r/20230908162254.999499-6-bigeasy@linutronix.de
Diffstat (limited to 'kernel/futex')
-rw-r--r-- | kernel/futex/pi.c | 11 |
1 files changed, 11 insertions, 0 deletions
diff --git a/kernel/futex/pi.c b/kernel/futex/pi.c index ce2889f12375..f8e65b27d9d6 100644 --- a/kernel/futex/pi.c +++ b/kernel/futex/pi.c @@ -1,6 +1,7 @@ // SPDX-License-Identifier: GPL-2.0-or-later #include <linux/slab.h> +#include <linux/sched/rt.h> #include <linux/sched/task.h> #include "futex.h" @@ -1002,6 +1003,12 @@ retry_private: goto no_block; } + /* + * Must be done before we enqueue the waiter, here is unfortunately + * under the hb lock, but that *should* work because it does nothing. + */ + rt_mutex_pre_schedule(); + rt_mutex_init_waiter(&rt_waiter); /* @@ -1052,6 +1059,10 @@ cleanup: if (ret && !rt_mutex_cleanup_proxy_lock(&q.pi_state->pi_mutex, &rt_waiter)) ret = 0; + /* + * Waiter is unqueued. + */ + rt_mutex_post_schedule(); no_block: /* * Fixup the pi_state owner and possibly acquire the lock if we |