diff options
author | Ingo Molnar <mingo@kernel.org> | 2020-03-30 13:08:41 +0200 |
---|---|---|
committer | Ingo Molnar <mingo@kernel.org> | 2020-03-30 13:08:41 +0200 |
commit | 313f16e2e35abb833eab5bdebc6ae30699adca18 (patch) | |
tree | e4eadcc2f068ee01e8fb20c954d88299695748c1 | |
parent | 9c40365a65d62d7c06a95fb331b3442cb02d2fd9 (diff) | |
parent | 4e139c7711633365ebb52fbb63905395522a8413 (diff) | |
download | linux-313f16e2e35abb833eab5bdebc6ae30699adca18.tar.bz2 |
Merge branch 'sched/rt' into sched/core, to pick up completed topic tree
Signed-off-by: Ingo Molnar <mingo@kernel.org>
-rw-r--r-- | include/linux/kernel.h | 7 | ||||
-rw-r--r-- | include/linux/preempt.h | 30 |
2 files changed, 37 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. diff --git a/include/linux/preempt.h b/include/linux/preempt.h index bbb68dba37cc..bc3f1aecaa19 100644 --- a/include/linux/preempt.h +++ b/include/linux/preempt.h @@ -322,4 +322,34 @@ static inline void preempt_notifier_init(struct preempt_notifier *notifier, #endif +/** + * migrate_disable - Prevent migration of the current task + * + * Maps to preempt_disable() which also disables preemption. Use + * migrate_disable() to annotate that the intent is to prevent migration, + * but not necessarily preemption. + * + * Can be invoked nested like preempt_disable() and needs the corresponding + * number of migrate_enable() invocations. + */ +static __always_inline void migrate_disable(void) +{ + preempt_disable(); +} + +/** + * migrate_enable - Allow migration of the current task + * + * Counterpart to migrate_disable(). + * + * As migrate_disable() can be invoked nested, only the outermost invocation + * reenables migration. + * + * Currently mapped to preempt_enable(). + */ +static __always_inline void migrate_enable(void) +{ + preempt_enable(); +} + #endif /* __LINUX_PREEMPT_H */ |