summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--include/linux/sched.h3
-rw-r--r--kernel/sched/core.c21
2 files changed, 24 insertions, 0 deletions
diff --git a/include/linux/sched.h b/include/linux/sched.h
index 6efcd19..4c758c5 100644
--- a/include/linux/sched.h
+++ b/include/linux/sched.h
@@ -1281,6 +1281,9 @@ struct task_struct {
unsigned int policy;
#ifdef CONFIG_PREEMPT_RT_FULL
int migrate_disable;
+# ifdef CONFIG_SCHED_DEBUG
+ int migrate_disable_atomic;
+# endif
#endif
int nr_cpus_allowed;
cpumask_t cpus_allowed;
diff --git a/kernel/sched/core.c b/kernel/sched/core.c
index 3fa81f5..c111f13 100644
--- a/kernel/sched/core.c
+++ b/kernel/sched/core.c
@@ -4817,6 +4817,17 @@ void migrate_disable(void)
unsigned long flags;
struct rq *rq;
+ if (in_atomic()) {
+#ifdef CONFIG_SCHED_DEBUG
+ p->migrate_disable_atomic++;
+#endif
+ return;
+ }
+
+#ifdef CONFIG_SCHED_DEBUG
+ WARN_ON_ONCE(p->migrate_disable_atomic);
+#endif
+
preempt_disable();
if (p->migrate_disable) {
p->migrate_disable++;
@@ -4865,6 +4876,16 @@ void migrate_enable(void)
unsigned long flags;
struct rq *rq;
+ if (in_atomic()) {
+#ifdef CONFIG_SCHED_DEBUG
+ p->migrate_disable_atomic--;
+#endif
+ return;
+ }
+
+#ifdef CONFIG_SCHED_DEBUG
+ WARN_ON_ONCE(p->migrate_disable_atomic);
+#endif
WARN_ON_ONCE(p->migrate_disable <= 0);
preempt_disable();