Commit b18d541d authored by Randy Dunlap's avatar Randy Dunlap Committed by Linus Torvalds

[PATCH] janitor: schedule_timeout sets curr->state (arm)

From: Alexey Dobriyan <adobriyan@mail.ru>

Don't set process state to TASK_RUNNING after a schedule_timeout(), since
there's no way we will return from the scheduler if we're not running.
parent 2d2ec635
...@@ -274,7 +274,6 @@ pci_pool_alloc (struct pci_pool *pool, int mem_flags, dma_addr_t *handle) ...@@ -274,7 +274,6 @@ pci_pool_alloc (struct pci_pool *pool, int mem_flags, dma_addr_t *handle)
schedule_timeout (POOL_TIMEOUT_JIFFIES); schedule_timeout (POOL_TIMEOUT_JIFFIES);
current->state = TASK_RUNNING;
remove_wait_queue (&pool->waitq, &wait); remove_wait_queue (&pool->waitq, &wait);
goto restart; goto restart;
} }
......
...@@ -2723,7 +2723,6 @@ cy_wait_until_sent(struct tty_struct *tty, int timeout) ...@@ -2723,7 +2723,6 @@ cy_wait_until_sent(struct tty_struct *tty, int timeout)
/* Run one more char cycle */ /* Run one more char cycle */
current->state = TASK_INTERRUPTIBLE; current->state = TASK_INTERRUPTIBLE;
schedule_timeout(char_time * 5); schedule_timeout(char_time * 5);
current->state = TASK_RUNNING;
#ifdef CY_DEBUG_WAIT_UNTIL_SENT #ifdef CY_DEBUG_WAIT_UNTIL_SENT
printk("Clean (jiff=%lu)...done\n", jiffies); printk("Clean (jiff=%lu)...done\n", jiffies);
#endif #endif
......
...@@ -1488,7 +1488,6 @@ static void stli_delay(int len) ...@@ -1488,7 +1488,6 @@ static void stli_delay(int len)
if (len > 0) { if (len > 0) {
set_current_state(TASK_INTERRUPTIBLE); set_current_state(TASK_INTERRUPTIBLE);
schedule_timeout(len); schedule_timeout(len);
set_current_state(TASK_RUNNING);
} }
} }
......
...@@ -332,7 +332,6 @@ int RIODelay (struct Port *PortP, int njiffies) ...@@ -332,7 +332,6 @@ int RIODelay (struct Port *PortP, int njiffies)
rio_dprintk (RIO_DEBUG_DELAY, "delaying %d jiffies\n", njiffies); rio_dprintk (RIO_DEBUG_DELAY, "delaying %d jiffies\n", njiffies);
current->state = TASK_INTERRUPTIBLE; current->state = TASK_INTERRUPTIBLE;
schedule_timeout(njiffies); schedule_timeout(njiffies);
current->state = TASK_RUNNING;
func_exit(); func_exit();
if (signal_pending(current)) if (signal_pending(current))
...@@ -350,7 +349,6 @@ int RIODelay_ni (struct Port *PortP, int njiffies) ...@@ -350,7 +349,6 @@ int RIODelay_ni (struct Port *PortP, int njiffies)
rio_dprintk (RIO_DEBUG_DELAY, "delaying %d jiffies (ni)\n", njiffies); rio_dprintk (RIO_DEBUG_DELAY, "delaying %d jiffies (ni)\n", njiffies);
current->state = TASK_UNINTERRUPTIBLE; current->state = TASK_UNINTERRUPTIBLE;
schedule_timeout(njiffies); schedule_timeout(njiffies);
current->state = TASK_RUNNING;
func_exit(); func_exit();
return !RIO_FAIL; return !RIO_FAIL;
} }
......
...@@ -1224,7 +1224,6 @@ static void stl_delay(int len) ...@@ -1224,7 +1224,6 @@ static void stl_delay(int len)
if (len > 0) { if (len > 0) {
current->state = TASK_INTERRUPTIBLE; current->state = TASK_INTERRUPTIBLE;
schedule_timeout(len); schedule_timeout(len);
current->state = TASK_RUNNING;
} }
} }
......
...@@ -469,7 +469,6 @@ static int kenvctrld(void *__unused) ...@@ -469,7 +469,6 @@ static int kenvctrld(void *__unused)
current->state = TASK_INTERRUPTIBLE; current->state = TASK_INTERRUPTIBLE;
schedule_timeout(POLL_INTERVAL); schedule_timeout(POLL_INTERVAL);
current->state = TASK_RUNNING;
if (signal_pending(current)) if (signal_pending(current))
break; break;
......
...@@ -1036,7 +1036,6 @@ static int kenvctrld(void *__unused) ...@@ -1036,7 +1036,6 @@ static int kenvctrld(void *__unused)
for (;;) { for (;;) {
current->state = TASK_INTERRUPTIBLE; current->state = TASK_INTERRUPTIBLE;
schedule_timeout(poll_interval); schedule_timeout(poll_interval);
current->state = TASK_RUNNING;
if(signal_pending(current)) if(signal_pending(current))
break; break;
...@@ -1184,7 +1183,6 @@ static void __exit envctrl_cleanup(void) ...@@ -1184,7 +1183,6 @@ static void __exit envctrl_cleanup(void)
current->state = TASK_INTERRUPTIBLE; current->state = TASK_INTERRUPTIBLE;
schedule_timeout(HZ); schedule_timeout(HZ);
current->state = TASK_RUNNING;
} }
kenvctrld_task = NULL; kenvctrld_task = NULL;
} }
......
...@@ -1277,7 +1277,6 @@ static void uart_close(struct tty_struct *tty, struct file *filp) ...@@ -1277,7 +1277,6 @@ static void uart_close(struct tty_struct *tty, struct file *filp)
if (state->close_delay) { if (state->close_delay) {
set_current_state(TASK_INTERRUPTIBLE); set_current_state(TASK_INTERRUPTIBLE);
schedule_timeout(state->close_delay); schedule_timeout(state->close_delay);
set_current_state(TASK_RUNNING);
} }
} else if (!uart_console(port)) { } else if (!uart_console(port)) {
uart_change_pm(state, 3); uart_change_pm(state, 3);
......
...@@ -1388,7 +1388,6 @@ static void sa1100fb_disable_controller(struct sa1100fb_info *fbi) ...@@ -1388,7 +1388,6 @@ static void sa1100fb_disable_controller(struct sa1100fb_info *fbi)
LCCR0 &= ~LCCR0_LEN; /* Disable LCD Controller */ LCCR0 &= ~LCCR0_LEN; /* Disable LCD Controller */
schedule_timeout(20 * HZ / 1000); schedule_timeout(20 * HZ / 1000);
set_current_state(TASK_RUNNING);
remove_wait_queue(&fbi->ctrlr_wait, &wait); remove_wait_queue(&fbi->ctrlr_wait, &wait);
} }
......
...@@ -781,7 +781,6 @@ nfsd_write(struct svc_rqst *rqstp, struct svc_fh *fhp, loff_t offset, ...@@ -781,7 +781,6 @@ nfsd_write(struct svc_rqst *rqstp, struct svc_fh *fhp, loff_t offset,
dprintk("nfsd: write defer %d\n", current->pid); dprintk("nfsd: write defer %d\n", current->pid);
set_current_state(TASK_UNINTERRUPTIBLE); set_current_state(TASK_UNINTERRUPTIBLE);
schedule_timeout((HZ+99)/100); schedule_timeout((HZ+99)/100);
current->state = TASK_RUNNING;
dprintk("nfsd: write resume %d\n", current->pid); dprintk("nfsd: write resume %d\n", current->pid);
} }
......
...@@ -1182,7 +1182,6 @@ static ssize_t snd_rawmidi_write(struct file *file, const char *buf, size_t coun ...@@ -1182,7 +1182,6 @@ static ssize_t snd_rawmidi_write(struct file *file, const char *buf, size_t coun
spin_unlock_irq(&runtime->lock); spin_unlock_irq(&runtime->lock);
set_current_state(TASK_INTERRUPTIBLE); set_current_state(TASK_INTERRUPTIBLE);
timeout = schedule_timeout(30 * HZ); timeout = schedule_timeout(30 * HZ);
set_current_state(TASK_RUNNING);
remove_wait_queue(&runtime->sleep, &wait); remove_wait_queue(&runtime->sleep, &wait);
if (signal_pending(current)) if (signal_pending(current))
return result > 0 ? result : -ERESTARTSYS; return result > 0 ? result : -ERESTARTSYS;
...@@ -1210,7 +1209,6 @@ static ssize_t snd_rawmidi_write(struct file *file, const char *buf, size_t coun ...@@ -1210,7 +1209,6 @@ static ssize_t snd_rawmidi_write(struct file *file, const char *buf, size_t coun
spin_unlock_irq(&runtime->lock); spin_unlock_irq(&runtime->lock);
set_current_state(TASK_INTERRUPTIBLE); set_current_state(TASK_INTERRUPTIBLE);
timeout = schedule_timeout(30 * HZ); timeout = schedule_timeout(30 * HZ);
set_current_state(TASK_RUNNING);
remove_wait_queue(&runtime->sleep, &wait); remove_wait_queue(&runtime->sleep, &wait);
if (signal_pending(current)) if (signal_pending(current))
return result > 0 ? result : -ERESTARTSYS; return result > 0 ? result : -ERESTARTSYS;
......
...@@ -732,7 +732,6 @@ static int wait_clear_urbs(snd_usb_substream_t *subs) ...@@ -732,7 +732,6 @@ static int wait_clear_urbs(snd_usb_substream_t *subs)
break; break;
set_current_state(TASK_UNINTERRUPTIBLE); set_current_state(TASK_UNINTERRUPTIBLE);
schedule_timeout(1); schedule_timeout(1);
set_current_state(TASK_RUNNING);
} while (--timeout > 0); } while (--timeout > 0);
if (alive) if (alive)
snd_printk(KERN_ERR "timeout: still %d active urbs..\n", alive); snd_printk(KERN_ERR "timeout: still %d active urbs..\n", alive);
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment