Skip to content

Commit

Permalink
sched, cleanup, treewide: Remove set_current_state(TASK_RUNNING) afte…
Browse files Browse the repository at this point in the history
…r schedule()

schedule(), io_schedule() and schedule_timeout() always return
with TASK_RUNNING state set, so one more setting is unnecessary.

(All places in patch are visible good, only exception is
 kiblnd_scheduler() from:

      drivers/staging/lustre/lnet/klnds/o2iblnd/o2iblnd_cb.c

 Its schedule() is one line above standard 3 lines of unified diff)

No places where set_current_state() is used for mb().

Signed-off-by: Kirill Tkhai <[email protected]>
Signed-off-by: Peter Zijlstra (Intel) <[email protected]>
Link: http://lkml.kernel.org/r/1410529254.3569.23.camel@tkhai
Cc: Alasdair Kergon <[email protected]>
Cc: Anil Belur <[email protected]>
Cc: Arnd Bergmann <[email protected]>
Cc: Dave Kleikamp <[email protected]>
Cc: David Airlie <[email protected]>
Cc: David Howells <[email protected]>
Cc: Dmitry Eremin <[email protected]>
Cc: Frank Blaschka <[email protected]>
Cc: Greg Kroah-Hartman <[email protected]>
Cc: Heiko Carstens <[email protected]>
Cc: Helge Deller <[email protected]>
Cc: Isaac Huang <[email protected]>
Cc: James E.J. Bottomley <[email protected]>
Cc: James E.J. Bottomley <[email protected]>
Cc: J. Bruce Fields <[email protected]>
Cc: Jeff Dike <[email protected]>
Cc: Jesper Nilsson <[email protected]>
Cc: Jiri Slaby <[email protected]>
Cc: Laura Abbott <[email protected]>
Cc: Liang Zhen <[email protected]>
Cc: Linus Torvalds <[email protected]>
Cc: Martin Schwidefsky <[email protected]>
Cc: Masaru Nomura <[email protected]>
Cc: Michael Opdenacker <[email protected]>
Cc: Mikael Starvik <[email protected]>
Cc: Mike Snitzer <[email protected]>
Cc: Neil Brown <[email protected]>
Cc: Oleg Drokin <[email protected]>
Cc: Peng Tao <[email protected]>
Cc: Richard Weinberger <[email protected]>
Cc: Robert Love <[email protected]>
Cc: Steven Rostedt <[email protected]>
Cc: Trond Myklebust <[email protected]>
Cc: Ursula Braun <[email protected]>
Cc: Zi Shen Lim <[email protected]>
Cc: [email protected]
Cc: [email protected]
Cc: [email protected]
Cc: [email protected]
Cc: [email protected]
Cc: [email protected]
Cc: [email protected]
Cc: [email protected]
Cc: [email protected]
Cc: [email protected]
Cc: [email protected]
Cc: [email protected]
Cc: [email protected]
Cc: [email protected]
Cc: [email protected]
Cc: [email protected]
Cc: [email protected]
Signed-off-by: Ingo Molnar <[email protected]>
  • Loading branch information
Kirill Tkhai authored and Ingo Molnar committed Sep 19, 2014
1 parent 9c368b5 commit f139caf
Show file tree
Hide file tree
Showing 21 changed files with 0 additions and 29 deletions.
1 change: 0 additions & 1 deletion arch/cris/arch-v10/drivers/sync_serial.c
Original file line number Diff line number Diff line change
Expand Up @@ -1086,7 +1086,6 @@ static ssize_t sync_serial_write(struct file *file, const char *buf,
}
local_irq_restore(flags);
schedule();
set_current_state(TASK_RUNNING);
remove_wait_queue(&port->out_wait_q, &wait);
if (signal_pending(current))
return -EINTR;
Expand Down
1 change: 0 additions & 1 deletion arch/cris/arch-v32/drivers/sync_serial.c
Original file line number Diff line number Diff line change
Expand Up @@ -1089,7 +1089,6 @@ static ssize_t sync_serial_write(struct file *file, const char *buf,
}

schedule();
set_current_state(TASK_RUNNING);
remove_wait_queue(&port->out_wait_q, &wait);

if (signal_pending(current))
Expand Down
1 change: 0 additions & 1 deletion arch/um/drivers/random.c
Original file line number Diff line number Diff line change
Expand Up @@ -79,7 +79,6 @@ static ssize_t rng_dev_read (struct file *filp, char __user *buf, size_t size,
set_task_state(current, TASK_INTERRUPTIBLE);

schedule();
set_task_state(current, TASK_RUNNING);
remove_wait_queue(&host_read_wait, &wait);

if (atomic_dec_and_test(&host_sleep_count)) {
Expand Down
1 change: 0 additions & 1 deletion drivers/gpu/vga/vgaarb.c
Original file line number Diff line number Diff line change
Expand Up @@ -403,7 +403,6 @@ int vga_get(struct pci_dev *pdev, unsigned int rsrc, int interruptible)
}
schedule();
remove_wait_queue(&vga_wait_queue, &wait);
set_current_state(TASK_RUNNING);
}
return rc;
}
Expand Down
1 change: 0 additions & 1 deletion drivers/md/dm-bufio.c
Original file line number Diff line number Diff line change
Expand Up @@ -720,7 +720,6 @@ static void __wait_for_free_buffer(struct dm_bufio_client *c)

io_schedule();

set_task_state(current, TASK_RUNNING);
remove_wait_queue(&c->free_buffer_wait, &wait);

dm_bufio_lock(c);
Expand Down
1 change: 0 additions & 1 deletion drivers/parisc/power.c
Original file line number Diff line number Diff line change
Expand Up @@ -121,7 +121,6 @@ static int kpowerswd(void *param)
unsigned long soft_power_reg = (unsigned long) param;

schedule_timeout_interruptible(pwrsw_enabled ? HZ : HZ/POWERSWITCH_POLL_PER_SEC);
__set_current_state(TASK_RUNNING);

if (unlikely(!pwrsw_enabled))
continue;
Expand Down
2 changes: 0 additions & 2 deletions drivers/s390/net/claw.c
Original file line number Diff line number Diff line change
Expand Up @@ -481,7 +481,6 @@ claw_open(struct net_device *dev)
spin_unlock_irqrestore(
get_ccwdev_lock(privptr->channel[i].cdev), saveflags);
schedule();
set_current_state(TASK_RUNNING);
remove_wait_queue(&privptr->channel[i].wait, &wait);
if(rc != 0)
ccw_check_return_code(privptr->channel[i].cdev, rc);
Expand Down Expand Up @@ -828,7 +827,6 @@ claw_release(struct net_device *dev)
spin_unlock_irqrestore(
get_ccwdev_lock(privptr->channel[i].cdev), saveflags);
schedule();
set_current_state(TASK_RUNNING);
remove_wait_queue(&privptr->channel[i].wait, &wait);
if (rc != 0) {
ccw_check_return_code(privptr->channel[i].cdev, rc);
Expand Down
1 change: 0 additions & 1 deletion drivers/scsi/fcoe/fcoe.c
Original file line number Diff line number Diff line change
Expand Up @@ -1884,7 +1884,6 @@ static int fcoe_percpu_receive_thread(void *arg)
set_current_state(TASK_INTERRUPTIBLE);
spin_unlock_bh(&p->fcoe_rx_list.lock);
schedule();
set_current_state(TASK_RUNNING);
goto retry;
}

Expand Down
1 change: 0 additions & 1 deletion drivers/scsi/qla2xxx/qla_os.c
Original file line number Diff line number Diff line change
Expand Up @@ -4853,7 +4853,6 @@ qla2x00_do_dpc(void *data)
"DPC handler sleeping.\n");

schedule();
__set_current_state(TASK_RUNNING);

if (!base_vha->flags.init_done || ha->flags.mbox_busy)
goto end_loop;
Expand Down
3 changes: 0 additions & 3 deletions drivers/staging/lustre/lnet/klnds/o2iblnd/o2iblnd_cb.c
Original file line number Diff line number Diff line change
Expand Up @@ -3215,7 +3215,6 @@ kiblnd_connd (void *arg)

schedule_timeout(timeout);

set_current_state(TASK_RUNNING);
remove_wait_queue(&kiblnd_data.kib_connd_waitq, &wait);
spin_lock_irqsave(&kiblnd_data.kib_connd_lock, flags);
}
Expand Down Expand Up @@ -3432,7 +3431,6 @@ kiblnd_scheduler(void *arg)
busy_loops = 0;

remove_wait_queue(&sched->ibs_waitq, &wait);
set_current_state(TASK_RUNNING);
spin_lock_irqsave(&sched->ibs_lock, flags);
}

Expand Down Expand Up @@ -3507,7 +3505,6 @@ kiblnd_failover_thread(void *arg)

rc = schedule_timeout(long_sleep ? cfs_time_seconds(10) :
cfs_time_seconds(1));
set_current_state(TASK_RUNNING);
remove_wait_queue(&kiblnd_data.kib_failover_waitq, &wait);
write_lock_irqsave(glock, flags);

Expand Down
1 change: 0 additions & 1 deletion drivers/staging/lustre/lnet/klnds/socklnd/socklnd_cb.c
Original file line number Diff line number Diff line change
Expand Up @@ -2233,7 +2233,6 @@ ksocknal_connd (void *arg)
nloops = 0;
schedule_timeout(timeout);

set_current_state(TASK_RUNNING);
remove_wait_queue(&ksocknal_data.ksnd_connd_waitq, &wait);
spin_lock_bh(connd_lock);
}
Expand Down
1 change: 0 additions & 1 deletion drivers/staging/lustre/lustre/libcfs/fail.c
Original file line number Diff line number Diff line change
Expand Up @@ -131,7 +131,6 @@ int __cfs_fail_timeout_set(__u32 id, __u32 value, int ms, int set)
id, ms);
set_current_state(TASK_UNINTERRUPTIBLE);
schedule_timeout(cfs_time_seconds(ms) / 1000);
set_current_state(TASK_RUNNING);
CERROR("cfs_fail_timeout id %x awake\n", id);
}
return ret;
Expand Down
1 change: 0 additions & 1 deletion drivers/tty/bfin_jtag_comm.c
Original file line number Diff line number Diff line change
Expand Up @@ -77,7 +77,6 @@ bfin_jc_emudat_manager(void *arg)
pr_debug("waiting for readers\n");
__set_current_state(TASK_UNINTERRUPTIBLE);
schedule();
__set_current_state(TASK_RUNNING);
continue;
}

Expand Down
1 change: 0 additions & 1 deletion fs/afs/vlocation.c
Original file line number Diff line number Diff line change
Expand Up @@ -130,7 +130,6 @@ static int afs_vlocation_access_vl_by_id(struct afs_vlocation *vl,
/* second+ BUSY - sleep a little bit */
set_current_state(TASK_UNINTERRUPTIBLE);
schedule_timeout(1);
__set_current_state(TASK_RUNNING);
}
continue;
}
Expand Down
2 changes: 0 additions & 2 deletions fs/jfs/jfs_logmgr.c
Original file line number Diff line number Diff line change
Expand Up @@ -1585,7 +1585,6 @@ void jfs_flush_journal(struct jfs_log *log, int wait)
set_current_state(TASK_UNINTERRUPTIBLE);
LOGGC_UNLOCK(log);
schedule();
__set_current_state(TASK_RUNNING);
LOGGC_LOCK(log);
remove_wait_queue(&target->gcwait, &__wait);
}
Expand Down Expand Up @@ -2359,7 +2358,6 @@ int jfsIOWait(void *arg)
set_current_state(TASK_INTERRUPTIBLE);
spin_unlock_irq(&log_redrive_lock);
schedule();
__set_current_state(TASK_RUNNING);
}
} while (!kthread_should_stop());

Expand Down
3 changes: 0 additions & 3 deletions fs/jfs/jfs_txnmgr.c
Original file line number Diff line number Diff line change
Expand Up @@ -136,7 +136,6 @@ static inline void TXN_SLEEP_DROP_LOCK(wait_queue_head_t * event)
set_current_state(TASK_UNINTERRUPTIBLE);
TXN_UNLOCK();
io_schedule();
__set_current_state(TASK_RUNNING);
remove_wait_queue(event, &wait);
}

Expand Down Expand Up @@ -2808,7 +2807,6 @@ int jfs_lazycommit(void *arg)
set_current_state(TASK_INTERRUPTIBLE);
LAZY_UNLOCK(flags);
schedule();
__set_current_state(TASK_RUNNING);
remove_wait_queue(&jfs_commit_thread_wait, &wq);
}
} while (!kthread_should_stop());
Expand Down Expand Up @@ -2996,7 +2994,6 @@ int jfs_sync(void *arg)
set_current_state(TASK_INTERRUPTIBLE);
TXN_UNLOCK();
schedule();
__set_current_state(TASK_RUNNING);
}
} while (!kthread_should_stop());

Expand Down
1 change: 0 additions & 1 deletion fs/nfs/blocklayout/blocklayoutdev.c
Original file line number Diff line number Diff line change
Expand Up @@ -146,7 +146,6 @@ nfs4_blk_decode_device(struct nfs_server *server,

set_current_state(TASK_UNINTERRUPTIBLE);
schedule();
__set_current_state(TASK_RUNNING);
remove_wait_queue(&nn->bl_wq, &wq);

if (reply->status != BL_DEVICE_REQUEST_PROC) {
Expand Down
1 change: 0 additions & 1 deletion fs/nfs/blocklayout/blocklayoutdm.c
Original file line number Diff line number Diff line change
Expand Up @@ -76,7 +76,6 @@ static void dev_remove(struct net *net, dev_t dev)

set_current_state(TASK_UNINTERRUPTIBLE);
schedule();
__set_current_state(TASK_RUNNING);
remove_wait_queue(&nn->bl_wq, &wq);

out:
Expand Down
1 change: 0 additions & 1 deletion fs/nfsd/nfs4recover.c
Original file line number Diff line number Diff line change
Expand Up @@ -670,7 +670,6 @@ __cld_pipe_upcall(struct rpc_pipe *pipe, struct cld_msg *cmsg)
}

schedule();
set_current_state(TASK_RUNNING);

if (msg.errno < 0)
ret = msg.errno;
Expand Down
1 change: 0 additions & 1 deletion kernel/time/hrtimer.c
Original file line number Diff line number Diff line change
Expand Up @@ -1776,7 +1776,6 @@ schedule_hrtimeout_range_clock(ktime_t *expires, unsigned long delta,
*/
if (!expires) {
schedule();
__set_current_state(TASK_RUNNING);
return -EINTR;
}

Expand Down
3 changes: 0 additions & 3 deletions kernel/trace/ring_buffer_benchmark.c
Original file line number Diff line number Diff line change
Expand Up @@ -205,7 +205,6 @@ static void ring_buffer_consumer(void)
break;

schedule();
__set_current_state(TASK_RUNNING);
}
reader_finish = 0;
complete(&read_done);
Expand Down Expand Up @@ -379,7 +378,6 @@ static int ring_buffer_consumer_thread(void *arg)
break;

schedule();
__set_current_state(TASK_RUNNING);
}
__set_current_state(TASK_RUNNING);

Expand Down Expand Up @@ -407,7 +405,6 @@ static int ring_buffer_producer_thread(void *arg)
trace_printk("Sleeping for 10 secs\n");
set_current_state(TASK_INTERRUPTIBLE);
schedule_timeout(HZ * SLEEP_TIME);
__set_current_state(TASK_RUNNING);
}

if (kill_test)
Expand Down

0 comments on commit f139caf

Please sign in to comment.