Skip to content

Commit 313f16e

Browse files
author
Ingo Molnar
committed
Merge branch 'sched/rt' into sched/core, to pick up completed topic tree
Signed-off-by: Ingo Molnar <[email protected]>
2 parents 9c40365 + 4e139c7 commit 313f16e

File tree

2 files changed

+37
-0
lines changed

2 files changed

+37
-0
lines changed

include/linux/kernel.h

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -257,6 +257,13 @@ extern void __cant_sleep(const char *file, int line, int preempt_offset);
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

Lines changed: 30 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -322,4 +322,34 @@ static inline void preempt_notifier_init(struct preempt_notifier *notifier,
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 */

0 commit comments

Comments
 (0)