Re: Debug: sleeping function called from invalid context

From: Andrew Morton
Date: Mon Aug 18 2003 - 19:32:51 EST


Dave Jones <davej@xxxxxxxxxx> wrote:
>
> How spooky. now I got one too, (minus the noise).
>
> Call Trace:
> [<c0120022>] __might_sleep+0x5b/0x5f

It would be useful to know whether this was triggered by in_atomic() or by
irqs_disabled(). We're suspecting the latter.


diff -puN kernel/sched.c~might_sleep-diags kernel/sched.c
--- 25/kernel/sched.c~might_sleep-diags Mon Aug 18 14:09:41 2003
+++ 25-akpm/kernel/sched.c Mon Aug 18 14:11:55 2003
@@ -2795,13 +2795,19 @@ void __might_sleep(char *file, int line)
{
#if defined(in_atomic)
static unsigned long prev_jiffy; /* ratelimiting */
+ char *msg = NULL;

- if (in_atomic() || irqs_disabled()) {
+ if (in_atomic())
+ msg = "in atomic section";
+ else if (irqs_disabled())
+ msg = "with interrupts disabled";
+
+ if (msg) {
if (time_before(jiffies, prev_jiffy + HZ))
return;
prev_jiffy = jiffies;
- printk(KERN_ERR "Debug: sleeping function called from invalid"
- " context at %s:%d\n", file, line);
+ printk(KERN_ERR "Debug: sleeping function "
+ "called %s at %s:%d\n", msg, file, line);
dump_stack();
}
#endif

_

-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/