History

Merge branch 'sched/rt' into sched/core, to pick up completed topic tree

Ingo Molnar committed 6 years ago

Commit 313f16e2 parents 9c40365 4e139c72 files · +37 −0Browse files

Showing the changes to include/linux (2 of 2 files). Show all

Unified · Split

2 files
  1. include/linux/kernel.h +7 −0
  2. include/linux/preempt.h +30 −0
include/linux/kernel.h+7−0
@@ -257,6 +257,13 @@ extern void __cant_sleep(const char *file, int line, int preempt_offset); · 256 unmodified lines
257257
258258 #define might_sleep_if(cond) do { if (cond) might_sleep(); } while (0)
259259
260+#ifndef CONFIG_PREEMPT_RT
261+# define cant_migrate() cant_sleep()
262+#else
263+ /* Placeholder for now */
264+# define cant_migrate() do { } while (0)
265+#endif
266+
260267 /**
261268 * abs - return absolute value of an argument
262269 * @x: the value. If it is unsigned type, it is converted to signed type first.
include/linux/preempt.h+30−0
@@ -322,4 +322,34 @@ static inline void preempt_notifier_init(struct preempt_notifier *notifier, · 321 unmodified lines
322322
323323 #endif
324324
325+/**
326+ * migrate_disable - Prevent migration of the current task
327+ *
328+ * Maps to preempt_disable() which also disables preemption. Use
329+ * migrate_disable() to annotate that the intent is to prevent migration,
330+ * but not necessarily preemption.
331+ *
332+ * Can be invoked nested like preempt_disable() and needs the corresponding
333+ * number of migrate_enable() invocations.
334+ */
335+static __always_inline void migrate_disable(void)
336+{
337+ preempt_disable();
338+}
339+
340+/**
341+ * migrate_enable - Allow migration of the current task
342+ *
343+ * Counterpart to migrate_disable().
344+ *
345+ * As migrate_disable() can be invoked nested, only the outermost invocation
346+ * reenables migration.
347+ *
348+ * Currently mapped to preempt_enable().
349+ */
350+static __always_inline void migrate_enable(void)
351+{
352+ preempt_enable();
353+}
354+
325355 #endif /* __LINUX_PREEMPT_H */