Skip to content

Commit f139caf

Browse files
Kirill TkhaiIngo Molnar
Kirill Tkhai
authored and
Ingo Molnar
committed
sched, cleanup, treewide: Remove set_current_state(TASK_RUNNING) after 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 <ktkhai@parallels.com> Signed-off-by: Peter Zijlstra (Intel) <peterz@infradead.org> Link: http://lkml.kernel.org/r/1410529254.3569.23.camel@tkhai Cc: Alasdair Kergon <agk@redhat.com> Cc: Anil Belur <askb23@gmail.com> Cc: Arnd Bergmann <arnd@arndb.de> Cc: Dave Kleikamp <shaggy@kernel.org> Cc: David Airlie <airlied@linux.ie> Cc: David Howells <dhowells@redhat.com> Cc: Dmitry Eremin <dmitry.eremin@intel.com> Cc: Frank Blaschka <blaschka@linux.vnet.ibm.com> Cc: Greg Kroah-Hartman <gregkh@linuxfoundation.org> Cc: Heiko Carstens <heiko.carstens@de.ibm.com> Cc: Helge Deller <deller@gmx.de> Cc: Isaac Huang <he.huang@intel.com> Cc: James E.J. Bottomley <JBottomley@parallels.com> Cc: James E.J. Bottomley <jejb@parisc-linux.org> Cc: J. Bruce Fields <bfields@fieldses.org> Cc: Jeff Dike <jdike@addtoit.com> Cc: Jesper Nilsson <jesper.nilsson@axis.com> Cc: Jiri Slaby <jslaby@suse.cz> Cc: Laura Abbott <lauraa@codeaurora.org> Cc: Liang Zhen <liang.zhen@intel.com> Cc: Linus Torvalds <torvalds@linux-foundation.org> Cc: Martin Schwidefsky <schwidefsky@de.ibm.com> Cc: Masaru Nomura <massa.nomura@gmail.com> Cc: Michael Opdenacker <michael.opdenacker@free-electrons.com> Cc: Mikael Starvik <starvik@axis.com> Cc: Mike Snitzer <snitzer@redhat.com> Cc: Neil Brown <neilb@suse.de> Cc: Oleg Drokin <green@linuxhacker.ru> Cc: Peng Tao <bergwolf@gmail.com> Cc: Richard Weinberger <richard@nod.at> Cc: Robert Love <robert.w.love@intel.com> Cc: Steven Rostedt <rostedt@goodmis.org> Cc: Trond Myklebust <trond.myklebust@primarydata.com> Cc: Ursula Braun <ursula.braun@de.ibm.com> Cc: Zi Shen Lim <zlim.lnx@gmail.com> Cc: devel@driverdev.osuosl.org Cc: dm-devel@redhat.com Cc: dri-devel@lists.freedesktop.org Cc: fcoe-devel@open-fcoe.org Cc: jfs-discussion@lists.sourceforge.net Cc: linux390@de.ibm.com Cc: linux-afs@lists.infradead.org Cc: linux-cris-kernel@axis.com Cc: linux-kernel@vger.kernel.org Cc: linux-nfs@vger.kernel.org Cc: linux-parisc@vger.kernel.org Cc: linux-raid@vger.kernel.org Cc: linux-s390@vger.kernel.org Cc: linux-scsi@vger.kernel.org Cc: qla2xxx-upstream@qlogic.com Cc: user-mode-linux-devel@lists.sourceforge.net Cc: user-mode-linux-user@lists.sourceforge.net Signed-off-by: Ingo Molnar <mingo@kernel.org>
1 parent 9c368b5 commit f139caf

File tree

21 files changed

+0
-29
lines changed

21 files changed

+0
-29
lines changed

arch/cris/arch-v10/drivers/sync_serial.c

-1
Original file line numberDiff line numberDiff line change
@@ -1086,7 +1086,6 @@ static ssize_t sync_serial_write(struct file *file, const char *buf,
10861086
}
10871087
local_irq_restore(flags);
10881088
schedule();
1089-
set_current_state(TASK_RUNNING);
10901089
remove_wait_queue(&port->out_wait_q, &wait);
10911090
if (signal_pending(current))
10921091
return -EINTR;

arch/cris/arch-v32/drivers/sync_serial.c

-1
Original file line numberDiff line numberDiff line change
@@ -1089,7 +1089,6 @@ static ssize_t sync_serial_write(struct file *file, const char *buf,
10891089
}
10901090

10911091
schedule();
1092-
set_current_state(TASK_RUNNING);
10931092
remove_wait_queue(&port->out_wait_q, &wait);
10941093

10951094
if (signal_pending(current))

arch/um/drivers/random.c

-1
Original file line numberDiff line numberDiff line change
@@ -79,7 +79,6 @@ static ssize_t rng_dev_read (struct file *filp, char __user *buf, size_t size,
7979
set_task_state(current, TASK_INTERRUPTIBLE);
8080

8181
schedule();
82-
set_task_state(current, TASK_RUNNING);
8382
remove_wait_queue(&host_read_wait, &wait);
8483

8584
if (atomic_dec_and_test(&host_sleep_count)) {

drivers/gpu/vga/vgaarb.c

-1
Original file line numberDiff line numberDiff line change
@@ -403,7 +403,6 @@ int vga_get(struct pci_dev *pdev, unsigned int rsrc, int interruptible)
403403
}
404404
schedule();
405405
remove_wait_queue(&vga_wait_queue, &wait);
406-
set_current_state(TASK_RUNNING);
407406
}
408407
return rc;
409408
}

drivers/md/dm-bufio.c

-1
Original file line numberDiff line numberDiff line change
@@ -720,7 +720,6 @@ static void __wait_for_free_buffer(struct dm_bufio_client *c)
720720

721721
io_schedule();
722722

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

726725
dm_bufio_lock(c);

drivers/parisc/power.c

-1
Original file line numberDiff line numberDiff line change
@@ -121,7 +121,6 @@ static int kpowerswd(void *param)
121121
unsigned long soft_power_reg = (unsigned long) param;
122122

123123
schedule_timeout_interruptible(pwrsw_enabled ? HZ : HZ/POWERSWITCH_POLL_PER_SEC);
124-
__set_current_state(TASK_RUNNING);
125124

126125
if (unlikely(!pwrsw_enabled))
127126
continue;

drivers/s390/net/claw.c

-2
Original file line numberDiff line numberDiff line change
@@ -481,7 +481,6 @@ claw_open(struct net_device *dev)
481481
spin_unlock_irqrestore(
482482
get_ccwdev_lock(privptr->channel[i].cdev), saveflags);
483483
schedule();
484-
set_current_state(TASK_RUNNING);
485484
remove_wait_queue(&privptr->channel[i].wait, &wait);
486485
if(rc != 0)
487486
ccw_check_return_code(privptr->channel[i].cdev, rc);
@@ -828,7 +827,6 @@ claw_release(struct net_device *dev)
828827
spin_unlock_irqrestore(
829828
get_ccwdev_lock(privptr->channel[i].cdev), saveflags);
830829
schedule();
831-
set_current_state(TASK_RUNNING);
832830
remove_wait_queue(&privptr->channel[i].wait, &wait);
833831
if (rc != 0) {
834832
ccw_check_return_code(privptr->channel[i].cdev, rc);

drivers/scsi/fcoe/fcoe.c

-1
Original file line numberDiff line numberDiff line change
@@ -1884,7 +1884,6 @@ static int fcoe_percpu_receive_thread(void *arg)
18841884
set_current_state(TASK_INTERRUPTIBLE);
18851885
spin_unlock_bh(&p->fcoe_rx_list.lock);
18861886
schedule();
1887-
set_current_state(TASK_RUNNING);
18881887
goto retry;
18891888
}
18901889

drivers/scsi/qla2xxx/qla_os.c

-1
Original file line numberDiff line numberDiff line change
@@ -4853,7 +4853,6 @@ qla2x00_do_dpc(void *data)
48534853
"DPC handler sleeping.\n");
48544854

48554855
schedule();
4856-
__set_current_state(TASK_RUNNING);
48574856

48584857
if (!base_vha->flags.init_done || ha->flags.mbox_busy)
48594858
goto end_loop;

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

-3
Original file line numberDiff line numberDiff line change
@@ -3215,7 +3215,6 @@ kiblnd_connd (void *arg)
32153215

32163216
schedule_timeout(timeout);
32173217

3218-
set_current_state(TASK_RUNNING);
32193218
remove_wait_queue(&kiblnd_data.kib_connd_waitq, &wait);
32203219
spin_lock_irqsave(&kiblnd_data.kib_connd_lock, flags);
32213220
}
@@ -3432,7 +3431,6 @@ kiblnd_scheduler(void *arg)
34323431
busy_loops = 0;
34333432

34343433
remove_wait_queue(&sched->ibs_waitq, &wait);
3435-
set_current_state(TASK_RUNNING);
34363434
spin_lock_irqsave(&sched->ibs_lock, flags);
34373435
}
34383436

@@ -3507,7 +3505,6 @@ kiblnd_failover_thread(void *arg)
35073505

35083506
rc = schedule_timeout(long_sleep ? cfs_time_seconds(10) :
35093507
cfs_time_seconds(1));
3510-
set_current_state(TASK_RUNNING);
35113508
remove_wait_queue(&kiblnd_data.kib_failover_waitq, &wait);
35123509
write_lock_irqsave(glock, flags);
35133510

drivers/staging/lustre/lnet/klnds/socklnd/socklnd_cb.c

-1
Original file line numberDiff line numberDiff line change
@@ -2233,7 +2233,6 @@ ksocknal_connd (void *arg)
22332233
nloops = 0;
22342234
schedule_timeout(timeout);
22352235

2236-
set_current_state(TASK_RUNNING);
22372236
remove_wait_queue(&ksocknal_data.ksnd_connd_waitq, &wait);
22382237
spin_lock_bh(connd_lock);
22392238
}

drivers/staging/lustre/lustre/libcfs/fail.c

-1
Original file line numberDiff line numberDiff line change
@@ -131,7 +131,6 @@ int __cfs_fail_timeout_set(__u32 id, __u32 value, int ms, int set)
131131
id, ms);
132132
set_current_state(TASK_UNINTERRUPTIBLE);
133133
schedule_timeout(cfs_time_seconds(ms) / 1000);
134-
set_current_state(TASK_RUNNING);
135134
CERROR("cfs_fail_timeout id %x awake\n", id);
136135
}
137136
return ret;

drivers/tty/bfin_jtag_comm.c

-1
Original file line numberDiff line numberDiff line change
@@ -77,7 +77,6 @@ bfin_jc_emudat_manager(void *arg)
7777
pr_debug("waiting for readers\n");
7878
__set_current_state(TASK_UNINTERRUPTIBLE);
7979
schedule();
80-
__set_current_state(TASK_RUNNING);
8180
continue;
8281
}
8382

fs/afs/vlocation.c

-1
Original file line numberDiff line numberDiff line change
@@ -130,7 +130,6 @@ static int afs_vlocation_access_vl_by_id(struct afs_vlocation *vl,
130130
/* second+ BUSY - sleep a little bit */
131131
set_current_state(TASK_UNINTERRUPTIBLE);
132132
schedule_timeout(1);
133-
__set_current_state(TASK_RUNNING);
134133
}
135134
continue;
136135
}

fs/jfs/jfs_logmgr.c

-2
Original file line numberDiff line numberDiff line change
@@ -1585,7 +1585,6 @@ void jfs_flush_journal(struct jfs_log *log, int wait)
15851585
set_current_state(TASK_UNINTERRUPTIBLE);
15861586
LOGGC_UNLOCK(log);
15871587
schedule();
1588-
__set_current_state(TASK_RUNNING);
15891588
LOGGC_LOCK(log);
15901589
remove_wait_queue(&target->gcwait, &__wait);
15911590
}
@@ -2359,7 +2358,6 @@ int jfsIOWait(void *arg)
23592358
set_current_state(TASK_INTERRUPTIBLE);
23602359
spin_unlock_irq(&log_redrive_lock);
23612360
schedule();
2362-
__set_current_state(TASK_RUNNING);
23632361
}
23642362
} while (!kthread_should_stop());
23652363

fs/jfs/jfs_txnmgr.c

-3
Original file line numberDiff line numberDiff line change
@@ -136,7 +136,6 @@ static inline void TXN_SLEEP_DROP_LOCK(wait_queue_head_t * event)
136136
set_current_state(TASK_UNINTERRUPTIBLE);
137137
TXN_UNLOCK();
138138
io_schedule();
139-
__set_current_state(TASK_RUNNING);
140139
remove_wait_queue(event, &wait);
141140
}
142141

@@ -2808,7 +2807,6 @@ int jfs_lazycommit(void *arg)
28082807
set_current_state(TASK_INTERRUPTIBLE);
28092808
LAZY_UNLOCK(flags);
28102809
schedule();
2811-
__set_current_state(TASK_RUNNING);
28122810
remove_wait_queue(&jfs_commit_thread_wait, &wq);
28132811
}
28142812
} while (!kthread_should_stop());
@@ -2996,7 +2994,6 @@ int jfs_sync(void *arg)
29962994
set_current_state(TASK_INTERRUPTIBLE);
29972995
TXN_UNLOCK();
29982996
schedule();
2999-
__set_current_state(TASK_RUNNING);
30002997
}
30012998
} while (!kthread_should_stop());
30022999

fs/nfs/blocklayout/blocklayoutdev.c

-1
Original file line numberDiff line numberDiff line change
@@ -146,7 +146,6 @@ nfs4_blk_decode_device(struct nfs_server *server,
146146

147147
set_current_state(TASK_UNINTERRUPTIBLE);
148148
schedule();
149-
__set_current_state(TASK_RUNNING);
150149
remove_wait_queue(&nn->bl_wq, &wq);
151150

152151
if (reply->status != BL_DEVICE_REQUEST_PROC) {

fs/nfs/blocklayout/blocklayoutdm.c

-1
Original file line numberDiff line numberDiff line change
@@ -76,7 +76,6 @@ static void dev_remove(struct net *net, dev_t dev)
7676

7777
set_current_state(TASK_UNINTERRUPTIBLE);
7878
schedule();
79-
__set_current_state(TASK_RUNNING);
8079
remove_wait_queue(&nn->bl_wq, &wq);
8180

8281
out:

fs/nfsd/nfs4recover.c

-1
Original file line numberDiff line numberDiff line change
@@ -670,7 +670,6 @@ __cld_pipe_upcall(struct rpc_pipe *pipe, struct cld_msg *cmsg)
670670
}
671671

672672
schedule();
673-
set_current_state(TASK_RUNNING);
674673

675674
if (msg.errno < 0)
676675
ret = msg.errno;

kernel/time/hrtimer.c

-1
Original file line numberDiff line numberDiff line change
@@ -1776,7 +1776,6 @@ schedule_hrtimeout_range_clock(ktime_t *expires, unsigned long delta,
17761776
*/
17771777
if (!expires) {
17781778
schedule();
1779-
__set_current_state(TASK_RUNNING);
17801779
return -EINTR;
17811780
}
17821781

kernel/trace/ring_buffer_benchmark.c

-3
Original file line numberDiff line numberDiff line change
@@ -205,7 +205,6 @@ static void ring_buffer_consumer(void)
205205
break;
206206

207207
schedule();
208-
__set_current_state(TASK_RUNNING);
209208
}
210209
reader_finish = 0;
211210
complete(&read_done);
@@ -379,7 +378,6 @@ static int ring_buffer_consumer_thread(void *arg)
379378
break;
380379

381380
schedule();
382-
__set_current_state(TASK_RUNNING);
383381
}
384382
__set_current_state(TASK_RUNNING);
385383

@@ -407,7 +405,6 @@ static int ring_buffer_producer_thread(void *arg)
407405
trace_printk("Sleeping for 10 secs\n");
408406
set_current_state(TASK_INTERRUPTIBLE);
409407
schedule_timeout(HZ * SLEEP_TIME);
410-
__set_current_state(TASK_RUNNING);
411408
}
412409

413410
if (kill_test)

0 commit comments

Comments
 (0)