Commit 4eb9af2a8a431a832830f986fead7332dab27229

Authored by Oleg Nesterov
Committed by Linus Torvalds
1 parent 33430dc593

[PATCH] posix-timers: use schedule_timeout() in common_nsleep()

common_nsleep() reimplements schedule_timeout_interruptible() for unknown
reason.

Signed-off-by: Oleg Nesterov <oleg@tv-sign.ru>
Signed-off-by: Andrew Morton <akpm@osdl.org>
Signed-off-by: Linus Torvalds <torvalds@osdl.org>

Showing 1 changed file with 1 additions and 18 deletions Side-by-side Diff

kernel/posix-timers.c
... ... @@ -1295,13 +1295,6 @@
1295 1295 return error;
1296 1296 }
1297 1297  
1298   -static void nanosleep_wake_up(unsigned long __data)
1299   -{
1300   - struct task_struct *p = (struct task_struct *) __data;
1301   -
1302   - wake_up_process(p);
1303   -}
1304   -
1305 1298 /*
1306 1299 * The standard says that an absolute nanosleep call MUST wake up at
1307 1300 * the requested time in spite of clock settings. Here is what we do:
... ... @@ -1442,7 +1435,6 @@
1442 1435 int flags, struct timespec *tsave)
1443 1436 {
1444 1437 struct timespec t, dum;
1445   - struct timer_list new_timer;
1446 1438 DECLARE_WAITQUEUE(abs_wqueue, current);
1447 1439 u64 rq_time = (u64)0;
1448 1440 s64 left;
... ... @@ -1451,10 +1443,6 @@
1451 1443 &current_thread_info()->restart_block;
1452 1444  
1453 1445 abs_wqueue.flags = 0;
1454   - init_timer(&new_timer);
1455   - new_timer.expires = 0;
1456   - new_timer.data = (unsigned long) current;
1457   - new_timer.function = nanosleep_wake_up;
1458 1446 abs = flags & TIMER_ABSTIME;
1459 1447  
1460 1448 if (restart_block->fn == clock_nanosleep_restart) {
1461 1449  
... ... @@ -1490,13 +1478,8 @@
1490 1478 if (left < (s64)0)
1491 1479 break;
1492 1480  
1493   - new_timer.expires = jiffies + left;
1494   - __set_current_state(TASK_INTERRUPTIBLE);
1495   - add_timer(&new_timer);
  1481 + schedule_timeout_interruptible(left);
1496 1482  
1497   - schedule();
1498   -
1499   - del_timer_sync(&new_timer);
1500 1483 left = rq_time - get_jiffies_64();
1501 1484 } while (left > (s64)0 && !test_thread_flag(TIF_SIGPENDING));
1502 1485