aboutsummaryrefslogtreecommitdiffstats
path: root/kernel
diff options
context:
space:
mode:
authorNishanth Aravamudan <nacc@us.ibm.com>2005-09-10 03:27:24 -0400
committerLinus Torvalds <torvalds@g5.osdl.org>2005-09-10 13:06:37 -0400
commit75bcc8c5e1de78616b04ef9f317a293a7c1c163c (patch)
treefabdfd7fbc46baae5638b41648444d805e14eb3c /kernel
parent041e0e3b1970c508dc9a95b7dd9dc86271a7d7ac (diff)
[PATCH] kernel: fix-up schedule_timeout() usage
Use schedule_timeout_{,un}interruptible() instead of set_current_state()/schedule_timeout() to reduce kernel size. Signed-off-by: Nishanth Aravamudan <nacc@us.ibm.com> Signed-off-by: Andrew Morton <akpm@osdl.org> Signed-off-by: Linus Torvalds <torvalds@osdl.org>
Diffstat (limited to 'kernel')
-rw-r--r--kernel/compat.c9
-rw-r--r--kernel/signal.c3
-rw-r--r--kernel/timer.c18
3 files changed, 10 insertions, 20 deletions
diff --git a/kernel/compat.c b/kernel/compat.c
index ddfcaaa86623..102296e21ea8 100644
--- a/kernel/compat.c
+++ b/kernel/compat.c
@@ -48,8 +48,7 @@ static long compat_nanosleep_restart(struct restart_block *restart)
48 if (!time_after(expire, now)) 48 if (!time_after(expire, now))
49 return 0; 49 return 0;
50 50
51 current->state = TASK_INTERRUPTIBLE; 51 expire = schedule_timeout_interruptible(expire - now);
52 expire = schedule_timeout(expire - now);
53 if (expire == 0) 52 if (expire == 0)
54 return 0; 53 return 0;
55 54
@@ -82,8 +81,7 @@ asmlinkage long compat_sys_nanosleep(struct compat_timespec __user *rqtp,
82 return -EINVAL; 81 return -EINVAL;
83 82
84 expire = timespec_to_jiffies(&t) + (t.tv_sec || t.tv_nsec); 83 expire = timespec_to_jiffies(&t) + (t.tv_sec || t.tv_nsec);
85 current->state = TASK_INTERRUPTIBLE; 84 expire = schedule_timeout_interruptible(expire);
86 expire = schedule_timeout(expire);
87 if (expire == 0) 85 if (expire == 0)
88 return 0; 86 return 0;
89 87
@@ -795,8 +793,7 @@ compat_sys_rt_sigtimedwait (compat_sigset_t __user *uthese,
795 recalc_sigpending(); 793 recalc_sigpending();
796 spin_unlock_irq(&current->sighand->siglock); 794 spin_unlock_irq(&current->sighand->siglock);
797 795
798 current->state = TASK_INTERRUPTIBLE; 796 timeout = schedule_timeout_interruptible(timeout);
799 timeout = schedule_timeout(timeout);
800 797
801 spin_lock_irq(&current->sighand->siglock); 798 spin_lock_irq(&current->sighand->siglock);
802 sig = dequeue_signal(current, &s, &info); 799 sig = dequeue_signal(current, &s, &info);
diff --git a/kernel/signal.c b/kernel/signal.c
index 4980a073237f..b92c3c9f8b9a 100644
--- a/kernel/signal.c
+++ b/kernel/signal.c
@@ -2221,8 +2221,7 @@ sys_rt_sigtimedwait(const sigset_t __user *uthese,
2221 recalc_sigpending(); 2221 recalc_sigpending();
2222 spin_unlock_irq(&current->sighand->siglock); 2222 spin_unlock_irq(&current->sighand->siglock);
2223 2223
2224 current->state = TASK_INTERRUPTIBLE; 2224 timeout = schedule_timeout_interruptible(timeout);
2225 timeout = schedule_timeout(timeout);
2226 2225
2227 try_to_freeze(); 2226 try_to_freeze();
2228 spin_lock_irq(&current->sighand->siglock); 2227 spin_lock_irq(&current->sighand->siglock);
diff --git a/kernel/timer.c b/kernel/timer.c
index a0b716d62701..f4152fcd9f8e 100644
--- a/kernel/timer.c
+++ b/kernel/timer.c
@@ -1184,8 +1184,7 @@ static long __sched nanosleep_restart(struct restart_block *restart)
1184 if (!time_after(expire, now)) 1184 if (!time_after(expire, now))
1185 return 0; 1185 return 0;
1186 1186
1187 current->state = TASK_INTERRUPTIBLE; 1187 expire = schedule_timeout_interruptible(expire - now);
1188 expire = schedule_timeout(expire - now);
1189 1188
1190 ret = 0; 1189 ret = 0;
1191 if (expire) { 1190 if (expire) {
@@ -1213,8 +1212,7 @@ asmlinkage long sys_nanosleep(struct timespec __user *rqtp, struct timespec __us
1213 return -EINVAL; 1212 return -EINVAL;
1214 1213
1215 expire = timespec_to_jiffies(&t) + (t.tv_sec || t.tv_nsec); 1214 expire = timespec_to_jiffies(&t) + (t.tv_sec || t.tv_nsec);
1216 current->state = TASK_INTERRUPTIBLE; 1215 expire = schedule_timeout_interruptible(expire);
1217 expire = schedule_timeout(expire);
1218 1216
1219 ret = 0; 1217 ret = 0;
1220 if (expire) { 1218 if (expire) {
@@ -1612,10 +1610,8 @@ void msleep(unsigned int msecs)
1612{ 1610{
1613 unsigned long timeout = msecs_to_jiffies(msecs) + 1; 1611 unsigned long timeout = msecs_to_jiffies(msecs) + 1;
1614 1612
1615 while (timeout) { 1613 while (timeout)
1616 set_current_state(TASK_UNINTERRUPTIBLE); 1614 timeout = schedule_timeout_uninterruptible(timeout);
1617 timeout = schedule_timeout(timeout);
1618 }
1619} 1615}
1620 1616
1621EXPORT_SYMBOL(msleep); 1617EXPORT_SYMBOL(msleep);
@@ -1628,10 +1624,8 @@ unsigned long msleep_interruptible(unsigned int msecs)
1628{ 1624{
1629 unsigned long timeout = msecs_to_jiffies(msecs) + 1; 1625 unsigned long timeout = msecs_to_jiffies(msecs) + 1;
1630 1626
1631 while (timeout && !signal_pending(current)) { 1627 while (timeout && !signal_pending(current))
1632 set_current_state(TASK_INTERRUPTIBLE); 1628 timeout = schedule_timeout_interruptible(timeout);
1633 timeout = schedule_timeout(timeout);
1634 }
1635 return jiffies_to_msecs(timeout); 1629 return jiffies_to_msecs(timeout);
1636} 1630}
1637 1631