aboutsummaryrefslogtreecommitdiffstats
path: root/net
diff options
context:
space:
mode:
authorNishanth Aravamudan <nacc@us.ibm.com>2005-09-12 17:15:34 -0400
committerDavid S. Miller <davem@davemloft.net>2005-09-12 17:15:34 -0400
commit121caf577dc61588c1128821873a08cec48baf58 (patch)
tree751e2e6bf9b58aa4b40e8285d357b0cf083ae8cc /net
parent7672d0b54411371e0b6a831c1cb2f0ce615de6dc (diff)
[NET]: fix-up schedule_timeout() usage
Use schedule_timeout_{,un}interruptible() instead of set_current_state()/schedule_timeout() to reduce kernel size. Also use human-time conversion functions instead of hard-coded division to avoid rounding issues. Signed-off-by: Nishanth Aravamudan <nacc@us.ibm.com> Signed-off-by: Andrew Morton <akpm@osdl.org> Signed-off-by: David S. Miller <davem@davemloft.net>
Diffstat (limited to 'net')
-rw-r--r--net/core/pktgen.c13
-rw-r--r--net/ipv4/ipconfig.c6
-rw-r--r--net/irda/ircomm/ircomm_tty.c9
-rw-r--r--net/sunrpc/svcsock.c3
4 files changed, 11 insertions, 20 deletions
diff --git a/net/core/pktgen.c b/net/core/pktgen.c
index b3ad49fa7d78..ef430b1e8e42 100644
--- a/net/core/pktgen.c
+++ b/net/core/pktgen.c
@@ -1452,8 +1452,7 @@ static int proc_thread_write(struct file *file, const char __user *user_buffer,
1452 thread_lock(); 1452 thread_lock();
1453 t->control |= T_REMDEV; 1453 t->control |= T_REMDEV;
1454 thread_unlock(); 1454 thread_unlock();
1455 current->state = TASK_INTERRUPTIBLE; 1455 schedule_timeout_interruptible(msecs_to_jiffies(125)); /* Propagate thread->control */
1456 schedule_timeout(HZ/8); /* Propagate thread->control */
1457 ret = count; 1456 ret = count;
1458 sprintf(pg_result, "OK: rem_device_all"); 1457 sprintf(pg_result, "OK: rem_device_all");
1459 goto out; 1458 goto out;
@@ -1716,10 +1715,9 @@ static void spin(struct pktgen_dev *pkt_dev, __u64 spin_until_us)
1716 printk(KERN_INFO "sleeping for %d\n", (int)(spin_until_us - now)); 1715 printk(KERN_INFO "sleeping for %d\n", (int)(spin_until_us - now));
1717 while (now < spin_until_us) { 1716 while (now < spin_until_us) {
1718 /* TODO: optimise sleeping behavior */ 1717 /* TODO: optimise sleeping behavior */
1719 if (spin_until_us - now > (1000000/HZ)+1) { 1718 if (spin_until_us - now > jiffies_to_usecs(1)+1)
1720 current->state = TASK_INTERRUPTIBLE; 1719 schedule_timeout_interruptible(1);
1721 schedule_timeout(1); 1720 else if (spin_until_us - now > 100) {
1722 } else if (spin_until_us - now > 100) {
1723 do_softirq(); 1721 do_softirq();
1724 if (!pkt_dev->running) 1722 if (!pkt_dev->running)
1725 return; 1723 return;
@@ -2449,8 +2447,7 @@ static void pktgen_run_all_threads(void)
2449 } 2447 }
2450 thread_unlock(); 2448 thread_unlock();
2451 2449
2452 current->state = TASK_INTERRUPTIBLE; 2450 schedule_timeout_interruptible(msecs_to_jiffies(125)); /* Propagate thread->control */
2453 schedule_timeout(HZ/8); /* Propagate thread->control */
2454 2451
2455 pktgen_wait_all_threads_run(); 2452 pktgen_wait_all_threads_run();
2456} 2453}
diff --git a/net/ipv4/ipconfig.c b/net/ipv4/ipconfig.c
index 953129d392d2..e8674baaa8d9 100644
--- a/net/ipv4/ipconfig.c
+++ b/net/ipv4/ipconfig.c
@@ -1103,10 +1103,8 @@ static int __init ic_dynamic(void)
1103#endif 1103#endif
1104 1104
1105 jiff = jiffies + (d->next ? CONF_INTER_TIMEOUT : timeout); 1105 jiff = jiffies + (d->next ? CONF_INTER_TIMEOUT : timeout);
1106 while (time_before(jiffies, jiff) && !ic_got_reply) { 1106 while (time_before(jiffies, jiff) && !ic_got_reply)
1107 set_current_state(TASK_UNINTERRUPTIBLE); 1107 schedule_timeout_uninterruptible(1);
1108 schedule_timeout(1);
1109 }
1110#ifdef IPCONFIG_DHCP 1108#ifdef IPCONFIG_DHCP
1111 /* DHCP isn't done until we get a DHCPACK. */ 1109 /* DHCP isn't done until we get a DHCPACK. */
1112 if ((ic_got_reply & IC_BOOTP) 1110 if ((ic_got_reply & IC_BOOTP)
diff --git a/net/irda/ircomm/ircomm_tty.c b/net/irda/ircomm/ircomm_tty.c
index 5d1e61168eb7..6f20b4206e08 100644
--- a/net/irda/ircomm/ircomm_tty.c
+++ b/net/irda/ircomm/ircomm_tty.c
@@ -567,10 +567,8 @@ static void ircomm_tty_close(struct tty_struct *tty, struct file *filp)
567 self->tty = NULL; 567 self->tty = NULL;
568 568
569 if (self->blocked_open) { 569 if (self->blocked_open) {
570 if (self->close_delay) { 570 if (self->close_delay)
571 current->state = TASK_INTERRUPTIBLE; 571 schedule_timeout_interruptible(self->close_delay);
572 schedule_timeout(self->close_delay);
573 }
574 wake_up_interruptible(&self->open_wait); 572 wake_up_interruptible(&self->open_wait);
575 } 573 }
576 574
@@ -863,8 +861,7 @@ static void ircomm_tty_wait_until_sent(struct tty_struct *tty, int timeout)
863 spin_lock_irqsave(&self->spinlock, flags); 861 spin_lock_irqsave(&self->spinlock, flags);
864 while (self->tx_skb && self->tx_skb->len) { 862 while (self->tx_skb && self->tx_skb->len) {
865 spin_unlock_irqrestore(&self->spinlock, flags); 863 spin_unlock_irqrestore(&self->spinlock, flags);
866 current->state = TASK_INTERRUPTIBLE; 864 schedule_timeout_interruptible(poll_time);
867 schedule_timeout(poll_time);
868 spin_lock_irqsave(&self->spinlock, flags); 865 spin_lock_irqsave(&self->spinlock, flags);
869 if (signal_pending(current)) 866 if (signal_pending(current))
870 break; 867 break;
diff --git a/net/sunrpc/svcsock.c b/net/sunrpc/svcsock.c
index 05fe2e735538..51885b5f744e 100644
--- a/net/sunrpc/svcsock.c
+++ b/net/sunrpc/svcsock.c
@@ -1170,8 +1170,7 @@ svc_recv(struct svc_serv *serv, struct svc_rqst *rqstp, long timeout)
1170 while (rqstp->rq_arghi < pages) { 1170 while (rqstp->rq_arghi < pages) {
1171 struct page *p = alloc_page(GFP_KERNEL); 1171 struct page *p = alloc_page(GFP_KERNEL);
1172 if (!p) { 1172 if (!p) {
1173 set_current_state(TASK_UNINTERRUPTIBLE); 1173 schedule_timeout_uninterruptible(msecs_to_jiffies(500));
1174 schedule_timeout(HZ/2);
1175 continue; 1174 continue;
1176 } 1175 }
1177 rqstp->rq_argpages[rqstp->rq_arghi++] = p; 1176 rqstp->rq_argpages[rqstp->rq_arghi++] = p;