RE: Spinlocks and interrupts

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



> -----Original Message-----
> From: kernelnewbies-bounces+jharan=bytemobile.com@xxxxxxxxxxxxxxxxx
> [mailto:kernelnewbies-
> bounces+jharan=bytemobile.com@xxxxxxxxxxxxxxxxx] On Behalf Of Dave
> Hylands
> Sent: Thursday, November 10, 2011 11:07 AM
> To: Kai Meyer
> Cc: kernelnewbies@xxxxxxxxxxxxxxxxx
> Subject: Re: Spinlocks and interrupts
> 
> Hi Kai,
> 
> On Thu, Nov 10, 2011 at 10:14 AM, Kai Meyer <kai@xxxxxxxxxx> 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
Kernelnewbies@xxxxxxxxxxxxxxxxx
http://lists.kernelnewbies.org/mailman/listinfo/kernelnewbies


[Index of Archives]     [Newbies FAQ]     [Linux Kernel Mentors]     [Linux Kernel Development]     [IETF Annouce]     [Git]     [Networking]     [Security]     [Bugtraq]     [Yosemite]     [MIPS Linux]     [ARM Linux]     [Linux RAID]     [Linux SCSI]     [Linux ACPI]
  Powered by Linux