Commit aef745fc authored by Ingo Molnar's avatar Ingo Molnar

sched: clean up __might_sleep()

add KERN_ to the printout and clean up the flow a bit.
Signed-off-by: default avatarIngo Molnar <mingo@elte.hu>
parent 29cbef48
...@@ -8226,20 +8226,25 @@ void __might_sleep(char *file, int line) ...@@ -8226,20 +8226,25 @@ void __might_sleep(char *file, int line)
#ifdef in_atomic #ifdef in_atomic
static unsigned long prev_jiffy; /* ratelimiting */ static unsigned long prev_jiffy; /* ratelimiting */
if ((in_atomic() || irqs_disabled()) && if ((!in_atomic() && !irqs_disabled()) ||
system_state == SYSTEM_RUNNING && !oops_in_progress) { system_state != SYSTEM_RUNNING || oops_in_progress)
if (time_before(jiffies, prev_jiffy + HZ) && prev_jiffy) return;
return; if (time_before(jiffies, prev_jiffy + HZ) && prev_jiffy)
prev_jiffy = jiffies; return;
printk(KERN_ERR "BUG: sleeping function called from invalid" prev_jiffy = jiffies;
" context at %s:%d\n", file, line);
printk("in_atomic():%d, irqs_disabled():%d, pid: %d, name: %s\n", printk(KERN_ERR
in_atomic(), irqs_disabled(), current->pid, current->comm); "BUG: sleeping function called from invalid context at %s:%d\n",
debug_show_held_locks(current); file, line);
if (irqs_disabled()) printk(KERN_ERR
print_irqtrace_events(current); "in_atomic(): %d, irqs_disabled(): %d, pid: %d, name: %s\n",
dump_stack(); in_atomic(), irqs_disabled(),
} current->pid, current->comm);
debug_show_held_locks(current);
if (irqs_disabled())
print_irqtrace_events(current);
dump_stack();
#endif #endif
} }
EXPORT_SYMBOL(__might_sleep); EXPORT_SYMBOL(__might_sleep);
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment