On Wed, Oct 7, 2009 at 12:45 PM, govind raj nayak <[email protected]>wrote:
> Yes, spinlock would automatically disable kernel preemption. >>>>>>I don't think so, otherwise what is the use of spin_lock_irq_save api, if spin_lock api does it ?. I mean if spin_lock api >>>>>>is disabling the kernel preemption, then can a newly occured interrupt will preempt currently executing process which >>>>>>has taken a spin lock by spin_lock() api. Just confirm my understanding. >>>>>>>I don't think all the spinlock api will disable kernel preemption. We must check in kernel code, that on which API >>>>>>>preemption is disable or if anybody knows, please mention those ones. > I was just giving theeoritical overview. As far as I know not all > synchronization constructs would disable the kernel preemption >>>>>>Yes, agreed. >>>>>>Can we say if preemption is disable but interrupts are not, then interrupt handler won't be able to preempt the currently executing process. >>>>>> I am just asking, if we have disable the interrupts on local processor by some api, and suddenly if higher priority >>>>>> process/ interrupt comes (the first process which is currently executing has acquired a spin lock by >>>>>>spin_lock_irq_save() api). I just want to know weather the higher priority process/interrupt will preempt the lower priority >>>>>> process or it will spin. Just clear the confusion. Regards, Krishna > automatically (for instance when acquiring a big kernel lock). In addition > you could use preempt_enable() and preempt_disable() to explicitly enable or > disable kernel preemption. Thanks. > > -Govindraj > > On Wed, 07 Oct 2009 11:15:06 +0530 wrote > >Rajat San,Just asking (since i didn't see spinlock implementation in > kernel src),On Tue, Oct 6, 2009 at 5:52 PM, Rajat Jain wrote: > > Hello Govind, > > > What happens when you go for spin locks without > > disabling kernel preemption? Suppose you acquire > > a spin lock in a system call handler (a service > > routine on behalf of a user mode process) with > > kernel preemption enabled. > > This is not possible. Spin lock APIs disable kernel preemption > automatically.Spin lock APIs disables kernel preemption in all its api or > some specific apis only. Please confirm and elaborate. > > > Thanks, > > RajatBest regards,Krishna > > > <http://sigads.rediff.com/RealMedia/ads/click_nx.ads/www.rediffmail.com/signatureline....@middle?> >
