"Scheduling while atomic"

Matthew Dillon dillon at apollo.backplane.com
Sun Nov 19 23:13:20 PST 2006


:On 2006-11-19 18:47, walt wrote:
:> I find that asking a basic/dumb question of a smart group of people
:> is often a very quick path to enlightenment :o)
:> 
:> I've seen the 'scheduling while atomic' panic message a few times
:> from the linux kernel over the years, and now I'm wondering if there
:> is an analogous panic in the BSD kernels, DF in particular.
:> 
:> If so, what would trigger such an event?
:
:I'm certainly not one of the smart people but I do believe (from the 
:name) that such a panic would occur if trying to call the scheduler 
:while performing an atomic operation (being inside a critical section). 
:The reason that this causes a panic would be that scheduling is not a 
:quick operation (not atomic-quick anyway).
:As to whether this can happen in DF or not I don't know, but it sure 
:sound like something that should panic the kernel. If there is code that 
:will cause such a panic is another question.
:
:--
:Erik Wikström

    Close.  Its ok to schedule while holding a critical section.  Critical sections
    are per-thread entities so the state would be restored when the thread is
    resumed.  But it is not ok to schedule while holding a spinlock.  A panic
    *will* occur if you tried to block while holding a spinlock.

					-Matt
					Matthew Dillon 
					<dillon at xxxxxxxxxxxxx>





More information about the Users mailing list