asmlinkage void __sched preempt_schedule(void)
{
        struct thread_info *ti = current_thread_info();
#ifdef CONFIG_PREEMPT_BKL
        struct task_struct *task = current;
        int saved_lock_depth;
#endif
        /*
         * If there is a non-zero preempt_count or interrupts are disabled,*
we do not want to preempt the current task.  Just return..
         */
        if (likely(ti->preempt_count || irqs_disabled()))
                return;

The above line from sched.c file shows that If we have any lock on the
current process means preempt_count is > 0 , then we can't preempt that
process; even if any process higher than that comes.



On Thu, Jul 30, 2009 at 2:31 PM, er krishna <[email protected]> wrote:

> Dear All,
>
> I have some confusion about preemption. Can anybody please clear my query :
>
> 1) If there are two process running in kernel space & one of them has a
> lock & its preempt_count value is +ve ,  can the other process preempt it ?
> If it preempt the first process ( which is in running state with a lock ) ,
> then how ( weather the second process has its priority must be higher than
> the running one ? )?
>
> Thanks & Best Regards,
> Krishna
>

Reply via email to