Commit 75bcc8c5e1de78616b04ef9f317a293a7c1c163c
Committed by
Linus Torvalds
1 parent
041e0e3b19
Exists in
master
and in
39 other branches
[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>
Showing 3 changed files with 10 additions and 20 deletions Side-by-side Diff
kernel/compat.c
... | ... | @@ -48,8 +48,7 @@ |
48 | 48 | if (!time_after(expire, now)) |
49 | 49 | return 0; |
50 | 50 | |
51 | - current->state = TASK_INTERRUPTIBLE; | |
52 | - expire = schedule_timeout(expire - now); | |
51 | + expire = schedule_timeout_interruptible(expire - now); | |
53 | 52 | if (expire == 0) |
54 | 53 | return 0; |
55 | 54 | |
... | ... | @@ -82,8 +81,7 @@ |
82 | 81 | return -EINVAL; |
83 | 82 | |
84 | 83 | expire = timespec_to_jiffies(&t) + (t.tv_sec || t.tv_nsec); |
85 | - current->state = TASK_INTERRUPTIBLE; | |
86 | - expire = schedule_timeout(expire); | |
84 | + expire = schedule_timeout_interruptible(expire); | |
87 | 85 | if (expire == 0) |
88 | 86 | return 0; |
89 | 87 | |
... | ... | @@ -795,8 +793,7 @@ |
795 | 793 | recalc_sigpending(); |
796 | 794 | spin_unlock_irq(¤t->sighand->siglock); |
797 | 795 | |
798 | - current->state = TASK_INTERRUPTIBLE; | |
799 | - timeout = schedule_timeout(timeout); | |
796 | + timeout = schedule_timeout_interruptible(timeout); | |
800 | 797 | |
801 | 798 | spin_lock_irq(¤t->sighand->siglock); |
802 | 799 | sig = dequeue_signal(current, &s, &info); |
kernel/signal.c
... | ... | @@ -2221,8 +2221,7 @@ |
2221 | 2221 | recalc_sigpending(); |
2222 | 2222 | spin_unlock_irq(¤t->sighand->siglock); |
2223 | 2223 | |
2224 | - current->state = TASK_INTERRUPTIBLE; | |
2225 | - timeout = schedule_timeout(timeout); | |
2224 | + timeout = schedule_timeout_interruptible(timeout); | |
2226 | 2225 | |
2227 | 2226 | try_to_freeze(); |
2228 | 2227 | spin_lock_irq(¤t->sighand->siglock); |
kernel/timer.c
... | ... | @@ -1184,8 +1184,7 @@ |
1184 | 1184 | if (!time_after(expire, now)) |
1185 | 1185 | return 0; |
1186 | 1186 | |
1187 | - current->state = TASK_INTERRUPTIBLE; | |
1188 | - expire = schedule_timeout(expire - now); | |
1187 | + expire = schedule_timeout_interruptible(expire - now); | |
1189 | 1188 | |
1190 | 1189 | ret = 0; |
1191 | 1190 | if (expire) { |
... | ... | @@ -1213,8 +1212,7 @@ |
1213 | 1212 | return -EINVAL; |
1214 | 1213 | |
1215 | 1214 | expire = timespec_to_jiffies(&t) + (t.tv_sec || t.tv_nsec); |
1216 | - current->state = TASK_INTERRUPTIBLE; | |
1217 | - expire = schedule_timeout(expire); | |
1215 | + expire = schedule_timeout_interruptible(expire); | |
1218 | 1216 | |
1219 | 1217 | ret = 0; |
1220 | 1218 | if (expire) { |
... | ... | @@ -1612,10 +1610,8 @@ |
1612 | 1610 | { |
1613 | 1611 | unsigned long timeout = msecs_to_jiffies(msecs) + 1; |
1614 | 1612 | |
1615 | - while (timeout) { | |
1616 | - set_current_state(TASK_UNINTERRUPTIBLE); | |
1617 | - timeout = schedule_timeout(timeout); | |
1618 | - } | |
1613 | + while (timeout) | |
1614 | + timeout = schedule_timeout_uninterruptible(timeout); | |
1619 | 1615 | } |
1620 | 1616 | |
1621 | 1617 | EXPORT_SYMBOL(msleep); |
... | ... | @@ -1628,10 +1624,8 @@ |
1628 | 1624 | { |
1629 | 1625 | unsigned long timeout = msecs_to_jiffies(msecs) + 1; |
1630 | 1626 | |
1631 | - while (timeout && !signal_pending(current)) { | |
1632 | - set_current_state(TASK_INTERRUPTIBLE); | |
1633 | - timeout = schedule_timeout(timeout); | |
1634 | - } | |
1627 | + while (timeout && !signal_pending(current)) | |
1628 | + timeout = schedule_timeout_interruptible(timeout); | |
1635 | 1629 | return jiffies_to_msecs(timeout); |
1636 | 1630 | } |
1637 | 1631 |