summaryrefslogtreecommitdiff
path: root/kernel/sched.c
diff options
context:
space:
mode:
authorArve Hjønnevåg <arve@android.com>2008-12-10 20:06:28 -0800
committerColin Cross <ccross@android.com>2011-06-14 09:08:40 -0700
commitf2a96a65e2486d60b3bcb47f5184462690b3eeac (patch)
tree29fd645ed44a0a69fde1f941b978b3c1e6d42886 /kernel/sched.c
parentac7df7d13e258e059dd75341043913498302dcb8 (diff)
sched: Enable might_sleep before initializing drivers.
This allows detection of init bugs in built-in drivers. Signed-off-by: Arve Hjønnevåg <arve@android.com>
Diffstat (limited to 'kernel/sched.c')
-rw-r--r--kernel/sched.c13
1 files changed, 12 insertions, 1 deletions
diff --git a/kernel/sched.c b/kernel/sched.c
index 3f2e502d609..ea7a385dacd 100644
--- a/kernel/sched.c
+++ b/kernel/sched.c
@@ -8037,13 +8037,24 @@ static inline int preempt_count_equals(int preempt_offset)
return (nested == preempt_offset);
}
+static int __might_sleep_init_called;
+int __init __might_sleep_init(void)
+{
+ __might_sleep_init_called = 1;
+ return 0;
+}
+early_initcall(__might_sleep_init);
+
void __might_sleep(const char *file, int line, int preempt_offset)
{
#ifdef in_atomic
static unsigned long prev_jiffy; /* ratelimiting */
if ((preempt_count_equals(preempt_offset) && !irqs_disabled()) ||
- system_state != SYSTEM_RUNNING || oops_in_progress)
+ oops_in_progress)
+ return;
+ if (system_state != SYSTEM_RUNNING &&
+ (!__might_sleep_init_called || system_state != SYSTEM_BOOTING))
return;
if (time_before(jiffies, prev_jiffy + HZ) && prev_jiffy)
return;