> -----Original Message-----
> From: [email protected]
> [mailto:kernelnewbies-
> [email protected]] On Behalf Of Dave
> Hylands
> Sent: Thursday, November 10, 2011 11:07 AM
> To: Kai Meyer
> Cc: [email protected]
> Subject: Re: Spinlocks and interrupts
> 
> Hi Kai,
> 
> On Thu, Nov 10, 2011 at 10:14 AM, Kai Meyer <[email protected]> wrote:
> > I think I get it. I'm hitting the scheduling while atomic because
I'm
> > calling my function from a struct bio's endio function, which is
> > probably running with a lock held somewhere else, and then my mutex
> > sleeps, while the spin_lock functions do not sleep.
> 
> Actually, just holding a lock doesn't create an atomic context.

I believe on kernels with kernel pre-emption enabled the act of taking
the lock disables pre-emption. If it didn't work this way you could end
up taking the lock in one process context and while the lock was held
get pre-empted. Then another process tries to take the lock and you dead
lock.

Jeff Haran




_______________________________________________
Kernelnewbies mailing list
[email protected]
http://lists.kernelnewbies.org/mailman/listinfo/kernelnewbies

Reply via email to