@@ -490,6 +490,7 @@ extern enum system_states {
SYSTEM_RESTART,
SYSTEM_SUSPEND,
} system_state;
+extern bool system_scheduling;
#define TAINT_PROPRIETARY_MODULE 0
#define TAINT_FORCED_MODULE 1
@@ -110,6 +110,14 @@ bool early_boot_irqs_disabled __read_mostly;
enum system_states system_state __read_mostly;
EXPORT_SYMBOL(system_state);
+/*
+ * This corresponds to system_state >= SYSTEM_SCHEDULING in the mainline.
+ * On PREEMPT_RT kernels, slab allocator requires this state to check if
+ * the allocation must be run with IRQ enabled or not.
+ */
+bool system_scheduling __read_mostly = false;
+EXPORT_SYMBOL(system_scheduling);
+
/*
* Boot command-line arguments
*/
@@ -401,6 +409,10 @@ static noinline void __init_refok rest_init(void)
rcu_read_lock();
kthreadd_task = find_task_by_pid_ns(pid, &init_pid_ns);
rcu_read_unlock();
+
+ /* Corresponds to system_state = SYSTEM_SCHEDULING in the mainline */
+ system_scheduling = true;
+
complete(&kthreadd_done);
/*