aboutsummaryrefslogtreecommitdiffstats
path: root/include/linux/kernel.h
diff options
context:
space:
mode:
authorThomas Gleixner <tglx@linutronix.de>2020-02-14 14:39:19 +0100
committerThomas Gleixner <tglx@linutronix.de>2020-02-20 21:17:24 +0100
commit4e139c7711633365ebb52fbb63905395522a8413 (patch)
treedf06f2cf410cfe8d1858ab4737ee25da7110f3bd /include/linux/kernel.h
parentsched/rt: Provide migrate_disable/enable() inlines (diff)
downloadlinux-dev-4e139c7711633365ebb52fbb63905395522a8413.tar.xz
linux-dev-4e139c7711633365ebb52fbb63905395522a8413.zip
sched: Provide cant_migrate()
Some code pathes rely on preempt_disable() to prevent migration on a non RT enabled kernel. These preempt_disable/enable() pairs are substituted by migrate_disable/enable() pairs or other forms of RT specific protection. On RT these protections prevent migration but not preemption. Obviously a cant_sleep() check in such a section will trigger on RT because preemption is not disabled. Provide a cant_migrate() macro which maps to cant_sleep() on a non RT kernel and an empty placeholder for RT for now. The placeholder will be changed to a proper debug check along with the RT specific migration protection mechanism. Signed-off-by: Thomas Gleixner <tglx@linutronix.de> Link: https://lkml.kernel.org/r/20200214161503.070487511@linutronix.de
Diffstat (limited to 'include/linux/kernel.h')
-rw-r--r--include/linux/kernel.h7
1 files changed, 7 insertions, 0 deletions
diff --git a/include/linux/kernel.h b/include/linux/kernel.h
index 0d9db2a14f44..9b7a8d74a9d6 100644
--- a/include/linux/kernel.h
+++ b/include/linux/kernel.h
@@ -257,6 +257,13 @@ extern void __cant_sleep(const char *file, int line, int preempt_offset);
#define might_sleep_if(cond) do { if (cond) might_sleep(); } while (0)
+#ifndef CONFIG_PREEMPT_RT
+# define cant_migrate() cant_sleep()
+#else
+ /* Placeholder for now */
+# define cant_migrate() do { } while (0)
+#endif
+
/**
* abs - return absolute value of an argument
* @x: the value. If it is unsigned type, it is converted to signed type first.