summaryrefslogtreecommitdiffstats
path: root/include/linux/preempt.h
diff options
context:
space:
mode:
authorAlexei Starovoitov <ast@kernel.org>2020-02-21 18:27:47 -0800
committerAlexei Starovoitov <ast@kernel.org>2020-02-21 18:27:47 -0800
commit8eece07c011f88da0ccf4127fca9a4e4faaf58ae (patch)
treef4cd731284fc654cdd7ddfab41b07e1599d8084b /include/linux/preempt.h
parent732a0dee501f9a693c9a711730838129f4587041 (diff)
parent4e139c7711633365ebb52fbb63905395522a8413 (diff)
downloadcachepc-linux-8eece07c011f88da0ccf4127fca9a4e4faaf58ae.tar.gz
cachepc-linux-8eece07c011f88da0ccf4127fca9a4e4faaf58ae.zip
Merge tag 'sched-for-bpf-2020-02-20' of git://git.kernel.org/pub/scm/linux/kernel/git/tip/tip into bpf-next
Two migrate disable related stubs for BPF to base the RT patches on
Diffstat (limited to 'include/linux/preempt.h')
-rw-r--r--include/linux/preempt.h30
1 files changed, 30 insertions, 0 deletions
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 */