From mboxrd@z Thu Jan 1 00:00:00 1970 From: Gustavo Franco Date: Fri, 16 Apr 2004 02:13:30 +0000 Subject: Re: [Kernel-janitors] [PATCH] - Replaces yield() with Message-Id: <407F414A.70708@legolas.alternex.com.br> List-Id: References: <407C9AEE.5020808@legolas.alternex.com.br> In-Reply-To: <407C9AEE.5020808@legolas.alternex.com.br> MIME-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit To: kernel-janitors@vger.kernel.org Randy.Dunlap wrote: >On Tue, 13 Apr 2004 22:59:10 -0300 Gustavo Franco wrote: > >| Hi, >| >| I'm new here, and this is my first patch, following the issue described by >| Matthew Wilcox: "Calling yield() Considered Harmful" on TODO list. >| >| There is no doubt that isn't necessary replace all yield() calls, but i'm >| planning to check each case on the tree.Comments? >| >| Hope that helps, >| Gustavo Franco >| p.s: This e-mail on the "from" is only for ML traffic, my main e-mail is >| stratus at acm.dot org. >| >| >| --- drivers/cdrom/cdu31a.c.orig 2004-04-13 22:43:55.000000000 -0300 >| +++ drivers/cdrom/cdu31a.c 2004-04-13 22:44:17.000000000 -0300 >| @@ -386,7 +386,7 @@ static inline void sony_sleep(void) >| unsigned long flags; >| >| >| if (cdu31a_irq <= 0) { >| - yield(); >| + schedule_timeout(1); >| } else { /* Interrupt driven */ >| >| save_flags(flags); > >Makes sense, except that the comment above the function bothers me: > >/* > * Wait a little while (used for polling the drive). If in initialization, > * setting a timeout doesn't work, so just loop for a while. > */ > >I expect that cdu31a_irq <= 0 means "in initializatgion," so is >using schedule_timeout() safe here? anyone checked this? > > > Good question. Read this bit from comments on the source. [...] * This interface is (unfortunately) a polled interface. This is * because most Sony interfaces are set up with DMA and interrupts * disables. Some (like mine) do not even have the capability to * handle interrupts or DMA. For this reason you will see a lot of * the following: * * retry_count = jiffies+ SONY_JIFFIES_TIMEOUT; * while (time_before(jiffies, retry_count) && (!