Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

[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>

authored by

Oleg Nesterov and committed by
Linus Torvalds
4eb9af2a 33430dc5

+1 -18
+1 -18
kernel/posix-timers.c
··· 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: ··· 1435 1442 int flags, struct timespec *tsave) 1436 1443 { 1437 1444 struct timespec t, dum; 1438 - struct timer_list new_timer; 1439 1445 DECLARE_WAITQUEUE(abs_wqueue, current); 1440 1446 u64 rq_time = (u64)0; 1441 1447 s64 left; ··· 1443 1451 &current_thread_info()->restart_block; 1444 1452 1445 1453 abs_wqueue.flags = 0; 1446 - init_timer(&new_timer); 1447 - new_timer.expires = 0; 1448 - new_timer.data = (unsigned long) current; 1449 - new_timer.function = nanosleep_wake_up; 1450 1454 abs = flags & TIMER_ABSTIME; 1451 1455 1452 1456 if (restart_block->fn == clock_nanosleep_restart) { ··· 1478 1490 if (left < (s64)0) 1479 1491 break; 1480 1492 1481 - new_timer.expires = jiffies + left; 1482 - __set_current_state(TASK_INTERRUPTIBLE); 1483 - add_timer(&new_timer); 1493 + schedule_timeout_interruptible(left); 1484 1494 1485 - schedule(); 1486 - 1487 - del_timer_sync(&new_timer); 1488 1495 left = rq_time - get_jiffies_64(); 1489 1496 } while (left > (s64)0 && !test_thread_flag(TIF_SIGPENDING)); 1490 1497