Skip to contentSkip to conversation

cleanup, treewide: Remove set_current_state(TASK_RUNNING) after schedule

PATCH New Kirill Tkhai 2 participants 10 messages Sep 12, 2014 – Sep 19, 2014 1 message not in the archive

Subsystems (21)
lore
Share & tools
lore

A message that is not in the archive (sent off-list or not yet received): 20140912132709.26840.4893.stgit@tkhai

#1 lore raw

PATCH 1/5 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().

---
 arch/cris/arch-v10/drivers/sync_serial.c           |    1 -
 arch/cris/arch-v32/drivers/sync_serial.c           |    1 -
 arch/um/drivers/random.c                           |    1 -
 drivers/gpu/vga/vgaarb.c                           |    1 -
 drivers/md/dm-bufio.c                              |    1 -
 drivers/parisc/power.c                             |    1 -
 drivers/s390/net/claw.c                            |    2 --
 drivers/scsi/fcoe/fcoe.c                           |    1 -
 drivers/scsi/qla2xxx/qla_os.c                      |    1 -
 .../staging/lustre/lnet/klnds/o2iblnd/o2iblnd_cb.c |    3 ---
 .../staging/lustre/lnet/klnds/socklnd/socklnd_cb.c |    1 -
 drivers/staging/lustre/lustre/libcfs/fail.c        |    1 -
 drivers/tty/bfin_jtag_comm.c                       |    1 -
 fs/afs/vlocation.c                                 |    1 -
 fs/jfs/jfs_logmgr.c                                |    2 --
 fs/jfs/jfs_txnmgr.c                                |    3 ---
 fs/nfs/blocklayout/blocklayoutdev.c                |    1 -
 fs/nfs/blocklayout/blocklayoutdm.c                 |    1 -
 fs/nfsd/nfs4recover.c                              |    1 -
 kernel/time/hrtimer.c                              |    1 -
 kernel/trace/ring_buffer_benchmark.c               |    3 ---
 21 files changed, 29 deletions(-)
arch/cris/arch-v10/drivers/sync_serial.c +0 -1
index 29eb02a..0f39832 100644
@@ -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;
arch/cris/arch-v32/drivers/sync_serial.c +0 -1
index bbb806b..5a14913 100644
@@ -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))
arch/um/drivers/random.c +0 -1
index 9e3a722..dd16c90 100644
@@ -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)) {
drivers/gpu/vga/vgaarb.c +0 -1
index d2077f0..d07f810 100644
@@ -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;
 }
drivers/md/dm-bufio.c +0 -1
index ab472c5..0505559 100644
@@ -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);
drivers/parisc/power.c +0 -1
index 90cca5e..ef31b77 100644
@@ -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;
drivers/s390/net/claw.c +0 -2
index fbc6701..213e54e 100644
@@ -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);
@@ -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);
drivers/scsi/fcoe/fcoe.c +0 -1
index 00ee0ed..4a8ac7d 100644
@@ -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;
 		}
 
drivers/scsi/qla2xxx/qla_os.c +0 -1
index be9698d..8b5a5dc 100644
@@ -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;
drivers/staging/lustre/lnet/klnds/o2iblnd/o2iblnd_cb.c +0 -3
index 306d728..b94f743 100644
@@ -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);
 	}
@@ -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);
 	}
 
@@ -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);
 
drivers/staging/lustre/lnet/klnds/socklnd/socklnd_cb.c +0 -1
index 5214399..9994fc6 100644
@@ -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);
 	}
drivers/staging/lustre/lustre/libcfs/fail.c +0 -1
index 1bf9c90..e73ca3d 100644
@@ -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;
drivers/tty/bfin_jtag_comm.c +0 -1
index 8096fcb..d7b198c 100644
@@ -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;
 		}
 
fs/afs/vlocation.c +0 -1
index b6df2e8..5297678 100644
@@ -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;
 			}
fs/jfs/jfs_logmgr.c +0 -2
index 0acddf6..bc462dc 100644
@@ -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);
 	}
@@ -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());
 
fs/jfs/jfs_txnmgr.c +0 -3
index 564c4f2..d595856 100644
@@ -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);
 }
 
@@ -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());
@@ -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());
 
fs/nfs/blocklayout/blocklayoutdev.c +0 -1
index 04303b5..9fde840 100644
@@ -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) {
fs/nfs/blocklayout/blocklayoutdm.c +0 -1
index 8999cfd..b18680e 100644
@@ -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:
fs/nfsd/nfs4recover.c +0 -1
index 9c271f4..8f1af78 100644
@@ -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;
kernel/time/hrtimer.c +0 -1
index 1c2fe7d..ab370ff 100644
@@ -1776,7 +1776,6 @@ schedule_hrtimeout_range_clock(ktime_t *expires, unsigned long delta,
 	 */
 	if (!expires) {
 		schedule();
-		__set_current_state(TASK_RUNNING);
 		return -EINTR;
 	}
 
kernel/trace/ring_buffer_benchmark.c +0 -3
index 0434ff1..3f9e328 100644
@@ -205,7 +205,6 @@ static void ring_buffer_consumer(void)
 			break;
 
 		schedule();
-		__set_current_state(TASK_RUNNING);
 	}
 	reader_finish = 0;
 	complete(&read_done);
@@ -379,7 +378,6 @@ static int ring_buffer_consumer_thread(void *arg)
 			break;
 
 		schedule();
-		__set_current_state(TASK_RUNNING);
 	}
 	__set_current_state(TASK_RUNNING);
 
@@ -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)
#2 lore raw

[tip:sched/core] sched, cleanup, treewide: Remove set_current_state(TASK_RUNNING) after schedule()

sched, cleanup, treewide: Remove set_current_state(TASK_RUNNING) after schedule()
Commit-ID:  f139caf2e89713687514d9db847a4fa2e29c87a2
Gitweb:     http://git.kernel.org/tip/f139caf2e89713687514d9db847a4fa2e29c87a2
Author:     Kirill Tkhai <[email protected]>
AuthorDate: Fri, 12 Sep 2014 17:40:54 +0400
Committer:  Ingo Molnar <[email protected]>
CommitDate: Fri, 19 Sep 2014 12:35:17 +0200

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().

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]>
---
 arch/cris/arch-v10/drivers/sync_serial.c               | 1 -
 arch/cris/arch-v32/drivers/sync_serial.c               | 1 -
 arch/um/drivers/random.c                               | 1 -
 drivers/gpu/vga/vgaarb.c                               | 1 -
 drivers/md/dm-bufio.c                                  | 1 -
 drivers/parisc/power.c                                 | 1 -
 drivers/s390/net/claw.c                                | 2 --
 drivers/scsi/fcoe/fcoe.c                               | 1 -
 drivers/scsi/qla2xxx/qla_os.c                          | 1 -
 drivers/staging/lustre/lnet/klnds/o2iblnd/o2iblnd_cb.c | 3 ---
 drivers/staging/lustre/lnet/klnds/socklnd/socklnd_cb.c | 1 -
 drivers/staging/lustre/lustre/libcfs/fail.c            | 1 -
 drivers/tty/bfin_jtag_comm.c                           | 1 -
 fs/afs/vlocation.c                                     | 1 -
 fs/jfs/jfs_logmgr.c                                    | 2 --
 fs/jfs/jfs_txnmgr.c                                    | 3 ---
 fs/nfs/blocklayout/blocklayoutdev.c                    | 1 -
 fs/nfs/blocklayout/blocklayoutdm.c                     | 1 -
 fs/nfsd/nfs4recover.c                                  | 1 -
 kernel/time/hrtimer.c                                  | 1 -
 kernel/trace/ring_buffer_benchmark.c                   | 3 ---
 21 files changed, 29 deletions(-)
arch/cris/arch-v10/drivers/sync_serial.c +0 -1
index 29eb02a..0f39832 100644
@@ -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;
arch/cris/arch-v32/drivers/sync_serial.c +0 -1
index bbb806b..5a14913 100644
@@ -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))
arch/um/drivers/random.c +0 -1
index 9e3a722..dd16c90 100644
@@ -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)) {
drivers/gpu/vga/vgaarb.c +0 -1
index d2077f0..d07f810 100644
@@ -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;
 }
drivers/md/dm-bufio.c +0 -1
index ab472c5..0505559 100644
@@ -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);
drivers/parisc/power.c +0 -1
index 90cca5e..ef31b77 100644
@@ -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;
drivers/s390/net/claw.c +0 -2
index fbc6701..213e54e 100644
@@ -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);
@@ -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);
drivers/scsi/fcoe/fcoe.c +0 -1
index 00ee0ed..4a8ac7d 100644
@@ -1884,7 +1884,6 @@ retry:
 			set_current_state(TASK_INTERRUPTIBLE);
 			spin_unlock_bh(&p->fcoe_rx_list.lock);
 			schedule();
-			set_current_state(TASK_RUNNING);
 			goto retry;
 		}
 
drivers/scsi/qla2xxx/qla_os.c +0 -1
index be9698d..8b5a5dc 100644
@@ -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;
drivers/staging/lustre/lnet/klnds/o2iblnd/o2iblnd_cb.c +0 -3
index 306d728..b94f743 100644
@@ -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);
 	}
@@ -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);
 	}
 
@@ -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);
 
drivers/staging/lustre/lnet/klnds/socklnd/socklnd_cb.c +0 -1
index 5214399..9994fc6 100644
@@ -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);
 	}
drivers/staging/lustre/lustre/libcfs/fail.c +0 -1
index 1bf9c90..e73ca3d 100644
@@ -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;
drivers/tty/bfin_jtag_comm.c +0 -1
index 8096fcb..d7b198c 100644
@@ -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;
 		}
 
fs/afs/vlocation.c +0 -1
index b6df2e8..5297678 100644
@@ -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;
 			}
fs/jfs/jfs_logmgr.c +0 -2
index 0acddf6..bc462dc 100644
@@ -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);
 	}
@@ -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());
 
fs/jfs/jfs_txnmgr.c +0 -3
index 564c4f2..d595856 100644
@@ -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);
 }
 
@@ -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());
@@ -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());
 
fs/nfs/blocklayout/blocklayoutdev.c +0 -1
index 04303b5..9fde840 100644
@@ -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) {
fs/nfs/blocklayout/blocklayoutdm.c +0 -1
index 8999cfd..b18680e 100644
@@ -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:
fs/nfsd/nfs4recover.c +0 -1
index 9c271f4..8f1af78 100644
@@ -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;
kernel/time/hrtimer.c +0 -1
index 1c2fe7d..ab370ff 100644
@@ -1776,7 +1776,6 @@ schedule_hrtimeout_range_clock(ktime_t *expires, unsigned long delta,
 	 */
 	if (!expires) {
 		schedule();
-		__set_current_state(TASK_RUNNING);
 		return -EINTR;
 	}
 
kernel/trace/ring_buffer_benchmark.c +0 -3
index 0434ff1..3f9e328 100644
@@ -205,7 +205,6 @@ static void ring_buffer_consumer(void)
 			break;
 
 		schedule();
-		__set_current_state(TASK_RUNNING);
 	}
 	reader_finish = 0;
 	complete(&read_done);
@@ -379,7 +378,6 @@ static int ring_buffer_consumer_thread(void *arg)
 			break;
 
 		schedule();
-		__set_current_state(TASK_RUNNING);
 	}
 	__set_current_state(TASK_RUNNING);
 
@@ -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)
#3 lore raw

PATCH 2/5 sched/fair: cleanup: Remove useless assignment in select_task_rq_fair()

In reply to a message not in the archive

new_cpu is reassigned below, so we do not need this here.

---
 kernel/sched/fair.c |    7 ++-----
 1 file changed, 2 insertions(+), 5 deletions(-)
kernel/sched/fair.c +2 -5
index be9e97b..3d1c08a 100644
@@ -4513,11 +4513,8 @@ select_task_rq_fair(struct task_struct *p, int prev_cpu, int sd_flag, int wake_f
 	if (p->nr_cpus_allowed == 1)
 		return prev_cpu;
 
-	if (sd_flag & SD_BALANCE_WAKE) {
-		if (cpumask_test_cpu(cpu, tsk_cpus_allowed(p)))
-			want_affine = 1;
-		new_cpu = prev_cpu;
-	}
+	if (sd_flag & SD_BALANCE_WAKE)
+		want_affine = cpumask_test_cpu(cpu, tsk_cpus_allowed(p));
 
 	rcu_read_lock();
 	for_each_domain(cpu, tmp) {
#4 lore raw

[tip:sched/core] sched/fair: cleanup: Remove useless assignment in select_task_rq_fair()

sched/fair: cleanup: Remove useless assignment in select_task_rq_fair()
Commit-ID:  a8edd075323cec607797fdd1d7b1222c987f4a47
Gitweb:     http://git.kernel.org/tip/a8edd075323cec607797fdd1d7b1222c987f4a47
Author:     Kirill Tkhai <[email protected]>
AuthorDate: Fri, 12 Sep 2014 17:41:16 +0400
Committer:  Ingo Molnar <[email protected]>
CommitDate: Fri, 19 Sep 2014 12:35:18 +0200

sched/fair: cleanup: Remove useless assignment in select_task_rq_fair()

new_cpu is reassigned below, so we do not need this here.

---
 kernel/sched/fair.c | 7 ++-----
 1 file changed, 2 insertions(+), 5 deletions(-)
kernel/sched/fair.c +2 -5
index 96e7147..9807a99 100644
@@ -4521,11 +4521,8 @@ select_task_rq_fair(struct task_struct *p, int prev_cpu, int sd_flag, int wake_f
 	if (p->nr_cpus_allowed == 1)
 		return prev_cpu;
 
-	if (sd_flag & SD_BALANCE_WAKE) {
-		if (cpumask_test_cpu(cpu, tsk_cpus_allowed(p)))
-			want_affine = 1;
-		new_cpu = prev_cpu;
-	}
+	if (sd_flag & SD_BALANCE_WAKE)
+		want_affine = cpumask_test_cpu(cpu, tsk_cpus_allowed(p));
 
 	rcu_read_lock();
 	for_each_domain(cpu, tmp) {
#5 lore raw

PATCH 3/5 sched/core: Use put_prev_task() accessor where possible.

In reply to a message not in the archive
---
 kernel/sched/core.c |    8 ++++----
 1 file changed, 4 insertions(+), 4 deletions(-)
kernel/sched/core.c +4 -4
index 07d67dd..d4399b4 100644
@@ -2998,7 +2998,7 @@ void rt_mutex_setprio(struct task_struct *p, int prio)
 	if (queued)
 		dequeue_task(rq, p, 0);
 	if (running)
-		p->sched_class->put_prev_task(rq, p);
+		put_prev_task(rq, p);
 
 	/*
 	 * Boosting condition are:
@@ -3551,7 +3551,7 @@ static int __sched_setscheduler(struct task_struct *p,
 	if (queued)
 		dequeue_task(rq, p, 0);
 	if (running)
-		p->sched_class->put_prev_task(rq, p);
+		put_prev_task(rq, p);
 
 	prev_class = p->sched_class;
 	__setscheduler(rq, p, attr);
@@ -4757,7 +4757,7 @@ void sched_setnuma(struct task_struct *p, int nid)
 	if (queued)
 		dequeue_task(rq, p, 0);
 	if (running)
-		p->sched_class->put_prev_task(rq, p);
+		put_prev_task(rq, p);
 
 	p->numa_preferred_nid = nid;
 
@@ -7339,7 +7339,7 @@ void sched_move_task(struct task_struct *tsk)
 	if (queued)
 		dequeue_task(rq, tsk, 0);
 	if (unlikely(running))
-		tsk->sched_class->put_prev_task(rq, tsk);
+		put_prev_task(rq, tsk);
 
 	tg = container_of(task_css_check(tsk, cpu_cgrp_id,
 				lockdep_is_held(&tsk->sighand->siglock)),
#6 lore raw

[tip:sched/core] sched/core: Use put_prev_task() accessor where possible

sched/core: Use put_prev_task() accessor where possible
Commit-ID:  f3cd1c4ec059c956d3346705e453aff3ace3b494
Gitweb:     http://git.kernel.org/tip/f3cd1c4ec059c956d3346705e453aff3ace3b494
Author:     Kirill Tkhai <[email protected]>
AuthorDate: Fri, 12 Sep 2014 17:41:40 +0400
Committer:  Ingo Molnar <[email protected]>
CommitDate: Fri, 19 Sep 2014 12:35:19 +0200

sched/core: Use put_prev_task() accessor where possible

---
 kernel/sched/core.c | 8 ++++----
 1 file changed, 4 insertions(+), 4 deletions(-)
kernel/sched/core.c +4 -4
index f7c6ed2..5536397 100644
@@ -3033,7 +3033,7 @@ void rt_mutex_setprio(struct task_struct *p, int prio)
 	if (queued)
 		dequeue_task(rq, p, 0);
 	if (running)
-		p->sched_class->put_prev_task(rq, p);
+		put_prev_task(rq, p);
 
 	/*
 	 * Boosting condition are:
@@ -3586,7 +3586,7 @@ change:
 	if (queued)
 		dequeue_task(rq, p, 0);
 	if (running)
-		p->sched_class->put_prev_task(rq, p);
+		put_prev_task(rq, p);
 
 	prev_class = p->sched_class;
 	__setscheduler(rq, p, attr);
@@ -4792,7 +4792,7 @@ void sched_setnuma(struct task_struct *p, int nid)
 	if (queued)
 		dequeue_task(rq, p, 0);
 	if (running)
-		p->sched_class->put_prev_task(rq, p);
+		put_prev_task(rq, p);
 
 	p->numa_preferred_nid = nid;
 
@@ -7374,7 +7374,7 @@ void sched_move_task(struct task_struct *tsk)
 	if (queued)
 		dequeue_task(rq, tsk, 0);
 	if (unlikely(running))
-		tsk->sched_class->put_prev_task(rq, tsk);
+		put_prev_task(rq, tsk);
 
 	tg = container_of(task_css_check(tsk, cpu_cgrp_id,
 				lockdep_is_held(&tsk->sighand->siglock)),
#7 lore raw

PATCH 4/5 sched/rt: Remove useless if from cleanup pick_next_task_rt()

In reply to a message not in the archive

_pick_next_task_rt() never returns NULL.

---
 kernel/sched/rt.c |    3 +--
 1 file changed, 1 insertion(+), 2 deletions(-)
kernel/sched/rt.c +1 -2
index 4feac8f..2e6a774 100644
@@ -1468,8 +1468,7 @@ pick_next_task_rt(struct rq *rq, struct task_struct *prev)
 	p = _pick_next_task_rt(rq);
 
 	/* The running task is never eligible for pushing */
-	if (p)
-		dequeue_pushable_task(rq, p);
+	dequeue_pushable_task(rq, p);
 
 	set_post_schedule(rq);
 
#8 lore raw

[tip:sched/core] sched/rt: Remove useless if from cleanup pick_next_task_rt()

sched/rt: Remove useless if from cleanup pick_next_task_rt()
Commit-ID:  f3f1768f89d601ad29f4701deef91caaa82b9f57
Gitweb:     http://git.kernel.org/tip/f3f1768f89d601ad29f4701deef91caaa82b9f57
Author:     Kirill Tkhai <[email protected]>
AuthorDate: Fri, 12 Sep 2014 17:42:01 +0400
Committer:  Ingo Molnar <[email protected]>
CommitDate: Fri, 19 Sep 2014 12:35:20 +0200

sched/rt: Remove useless if from cleanup pick_next_task_rt()

_pick_next_task_rt() never returns NULL.

---
 kernel/sched/rt.c | 3 +--
 1 file changed, 1 insertion(+), 2 deletions(-)
kernel/sched/rt.c +1 -2
index 4feac8f..2e6a774 100644
@@ -1468,8 +1468,7 @@ pick_next_task_rt(struct rq *rq, struct task_struct *prev)
 	p = _pick_next_task_rt(rq);
 
 	/* The running task is never eligible for pushing */
-	if (p)
-		dequeue_pushable_task(rq, p);
+	dequeue_pushable_task(rq, p);
 
 	set_post_schedule(rq);
 
#9 lore raw

PATCH 5/5 sched/dl: Simplify pick_dl_task()

In reply to a message not in the archive

1)Nobody calls pick_dl_task with negative cpu, it's old RT leftover.

2)If p->nr_cpus_allowed is 1, than the affinity has just been changed in set_cpus_allowed_ptr(); we'll pick it just earlier than migration thread.

---
 kernel/sched/deadline.c |    4 +---
 1 file changed, 1 insertion(+), 3 deletions(-)
kernel/sched/deadline.c +1 -3
index cc4eb89..aaa5abb 100644
@@ -1121,10 +1121,8 @@ static void set_curr_task_dl(struct rq *rq)
 static int pick_dl_task(struct rq *rq, struct task_struct *p, int cpu)
 {
 	if (!task_running(rq, p) &&
-	    (cpu < 0 || cpumask_test_cpu(cpu, &p->cpus_allowed)) &&
-	    (p->nr_cpus_allowed > 1))
+	    cpumask_test_cpu(cpu, tsk_cpus_allowed(p)))
 		return 1;
-
 	return 0;
 }
 
#10 lore raw

[tip:sched/core] sched/dl: Simplify pick_dl_task()

sched/dl: Simplify pick_dl_task()
Commit-ID:  1ba93d42727c44001aa8ccffd39c8ab5705379e2
Gitweb:     http://git.kernel.org/tip/1ba93d42727c44001aa8ccffd39c8ab5705379e2
Author:     Kirill Tkhai <[email protected]>
AuthorDate: Fri, 12 Sep 2014 17:42:20 +0400
Committer:  Ingo Molnar <[email protected]>
CommitDate: Fri, 19 Sep 2014 12:35:20 +0200

sched/dl: Simplify pick_dl_task()

1) Nobody calls pick_dl_task() with negative cpu, it's old RT leftover.

2) If p->nr_cpus_allowed is 1, than the affinity has just been changed in set_cpus_allowed_ptr(); we'll pick it just earlier than migration thread.

---
 kernel/sched/deadline.c | 4 +---
 1 file changed, 1 insertion(+), 3 deletions(-)
kernel/sched/deadline.c +1 -3
index cc4eb89..aaa5abb 100644
@@ -1121,10 +1121,8 @@ static void set_curr_task_dl(struct rq *rq)
 static int pick_dl_task(struct rq *rq, struct task_struct *p, int cpu)
 {
 	if (!task_running(rq, p) &&
-	    (cpu < 0 || cpumask_test_cpu(cpu, &p->cpus_allowed)) &&
-	    (p->nr_cpus_allowed > 1))
+	    cpumask_test_cpu(cpu, tsk_cpus_allowed(p)))
 		return 1;
-
 	return 0;
 }