Re: When is to preempt safe?

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

 



Hi!

On 23:53 Sat 08 Oct     , Dave Hylands wrote:
> Hi Michi,
> 
> On Sat, Oct 8, 2011 at 11:29 PM, Michael Blizek
> <michi1@xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx> wrote:
...
> > Disabling interrupts actually disables preemption as well. Preemption is
> > triggered by a timer interrupt, which cannot arrive in this case. Spinlocks
> > can be aquired both by disabling interrupts (spin_lock_irqsave) or by
> > disabling preemption (spin_lock_bh). However, you cannot use spin_lock_bh if
> > the same spin_lock is aquired in an interrupt handler. spin_lock_bh allows
> > interrupt handlers to be invoked while you are still in the critical section.
> > If the interrupt handler is processed on the same CPU as the critical section,
> > you are stuck in a deadlock.
> 
> Disabling interrupts DOES NOT disable preemption on an SMP machine. It
> only disables preemption on the core that interrupts are disabled on.

AFAIK there is no "global" preemption disable in linux. This operation would
be very slow. There is stop_machine for stuff like module loading, but I guess
this is not what you mean.

spin_lock_bh also disables preemption only on the local cpu.

	-Michi
-- 
programing a layer 3+4 network protocol for mesh networks
see http://michaelblizek.twilightparadox.com

_______________________________________________
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