---------------------------------------------- Original Message From: "J"<jeebu19@yahoo.com> Subject: Re: Q: deadlock Date: Mon, 11 Mar 2002 12:09:46 +0530 >On Sun, Mar 10, 2002 at 05:51:33AM -0600, pwa wrote: >> >> I do not see why this is a problem since spinlocks are SMP only. >> I thought the scheduler (called e.g implicetly by a timer interrupt) would >> eventually make the process holding the spinlock runable. Then this process >> would release the spinlock, and the busy waiting process wold enter the >> critical region? > >Interrupt control path will not call scheduler, but while returning >a check is made whether the interrupted control path was either >user mode or VM86 mode. If neither the scheduler is bypassed. > >Regards, >Sourav Is a critical region protected by a spinlock considered an interrupt control path? The spin_lock function seems to be doing nothin more than a while(locked) ; Consider the following code: spin_lock(&lock); copy_to_user(buf, data, size); spin_unlock(&lock); AFAIK if the process (#1) holding the spinlock blocks while calling copy_to_user, schedule is called. The next process (#2) tries to enter the critical region, and spins on the lock. If/when the pages requested by the copy_to_user are retrived from swap, an interrupt should occur. Schedule should mark #1 as running, and #1 should release the lock. Is the problem here the unlikely(?) situation that the pages are not retrivable from swap? -pwa. _____________________________________________ Free email with personality! Over 200 domains! http://www.MyOwnEmail.com -- Kernelnewbies: Help each other learn about the Linux kernel. Archive: http://mail.nl.linux.org/kernelnewbies/ FAQ: http://kernelnewbies.org/faq/