Skip to content

Commit 4e139c7

Browse files
committed
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 <[email protected]> Link: https://lkml.kernel.org/r/[email protected]
1 parent 6663005 commit 4e139c7

File tree

1 file changed

+7
-0
lines changed

1 file changed

+7
-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.

0 commit comments

Comments
 (0)