Re: How spin_lock and preempt disable works?

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

 



On Sat, Apr 29, 2006 at 17:08:38 +0530, Manjunath Naik wrote:
> On 4/29/06, Hareesh Nagarajan <hnagar2@xxxxxxxxx> wrote:
> >On 4/29/06, Manjunath Naik <peter.desouzain@xxxxxxxxx> wrote:
> >> #define preempt_disable() \
> >> But I was not able to understand how exactly preempting works. when
> >
> >While we hold a spin lock to protect a critical region, it is
> >necessary for us to disable preemption. To disable preemption, we
> >increment the preempt count.
> >
> >> schedular wants to schedule the other process, it checks the
> >> thread_info->preempt_count value? If it is yes plese provide me some
> >links
> >> or code reference for it.
> >
> >Documentation/preempt-locking.txt
> >
> If prempt_count is incremented how it will leads to disable the
> preemption? who will check the counter? Is scheduler will check this counter
> before selecting other process for context switch. If yes, how sheduler gets
> the priority to run itself.

The scheduler checks the preempt_count flag and will not preempt the running
task if it's non-0.

Scheduler is not a process. There are two entry points for it that are part
of the interrupt handling code (so it gets a chance to run at least after
each timer interrupt). One is during return to userspace (this was always
there and handles preempting user-space code) and another along where
bottom-halves are run, which deals with the preemption.

-- 
						 Jan 'Bulb' Hudec <bulb@xxxxxx>

Attachment: signature.asc
Description: Digital signature


[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