Hi,
On Tue, Apr 18, 2006 at 03:23:01PM +0800, Liu haixiang wrote:
> Hi All,
>
> Now I am developing the driver on Linux kernel 2.6.11. And I met the
> problem that kernel will dump my stack from time to time. And the
> kernel log will give me messages like "scheduling while atomic: ...".
>
> Then I found the code in sched.c:
>
> if (likely(!current->exit_state)) {
> if (unlikely(in_atomic())) {
> printk(KERN_ERR "scheduling while atomic: "
> "%s/0x%08x/%d\n",
> current->comm, preempt_count(), current->pid);
> dump_stack();
> }
> }
>
> Anybody can explain above code for me?
OK, I'll try, but there should be many references and explanations to it
on the internet already (did you look?).
If the current task is running and thus not yet exiting (!current->exit_state)
and is also in an atomic code section (i.e. under lock), it shouldn't call
any reschedule function (which also happens by just calling msleep(): use
mdelay() instead in that case!).
Generally spoken you should leave locked code sections ASAP (don't waste
too much time in there), and not call any functions that schedule to the
next task in there (msleep(), ...).
BTW, the code above is an old unoptimized version, fixed by me recently.
Andreas Mohr
-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to [email protected]
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/
[Index of Archives]
[Kernel Newbies]
[Netfilter]
[Bugtraq]
[Photo]
[Stuff]
[Gimp]
[Yosemite News]
[MIPS Linux]
[ARM Linux]
[Linux Security]
[Linux RAID]
[Video 4 Linux]
[Linux for the blind]
[Linux Resources]