diff options
authorNicolas Pitre <>2017-08-02 14:12:29 -0400
committerNicolas Pitre <>2017-10-06 15:33:37 -0400
commit08421be0d951e620c916998260d9e6b6bfd97ae4 (patch)
parent173fd92262454375fd51e117abe80d3c8b3a4378 (diff)
futex: let it compile when the RT mutex fallback is active
The previous patch introduced RT mutex compatibility wrappers for when there is no actual RT task support configured in. The futex code already disables its PI support when actual RT mutex is not available but it does so by dead code elimination to keep the number of #ifdef's to a minimum. However the futex code is more intimate with RT mutex internals than typical users by directly referencing structure fields that happens not to be present in the compatibility structure. To keep the compiler happy, let's introduce a NO_RT_MUTEX_FALLBACK directive to let futex.c access the real rt_mutex structure. All that code is eventually optimized away so the end result remains the same without having to rely on more #ifdef's. Signed-off-by: Nicolas Pitre <>
2 files changed, 9 insertions, 1 deletions
diff --git a/include/linux/rtmutex.h b/include/linux/rtmutex.h
index baa7c4e6e9ef..2560dd52d487 100644
--- a/include/linux/rtmutex.h
+++ b/include/linux/rtmutex.h
@@ -14,7 +14,7 @@
#define CONFIG_SCHED_RT /* temporary until kconfig defines it */
+#if defined(CONFIG_SCHED_RT) || defined(NO_RT_MUTEX_FALLBACK)
#include <linux/linkage.h>
#include <linux/rbtree.h>
diff --git a/kernel/futex.c b/kernel/futex.c
index 3d38eaf05492..1f607c0108c4 100644
--- a/kernel/futex.c
+++ b/kernel/futex.c
@@ -70,6 +70,14 @@
#include <asm/futex.h>
+ * When CONFIG_RT_MUTEXES=n we also have CONFIG_FUTEX_PI=n and therefore
+ * all the PI code is optimized away. But to make the compiler happy
+ * let's pretend we do have RT mutex support enabled so that the
+ * yet-to-be-discarded code can still get at the real rt_mutex structure
+ * fields that the RT mutex fallback in <linux/rtmutex.h> doesn't have.
+ */
#include "locking/rtmutex_common.h"