Skip to contentSkip to conversation

2.6.24-rcx: Make sys_poll() wait at least timeout ms

RFC/PATCH Karsten Wiese 1 participant 1 message Dec 18, 2007 VFS

lore
Share & tools
lore
#0 lore raw

Hi,

while playing with jackd on 2.6.24-rcx, I found poll() timing out too early. That is: earlier than its timeout argument specified.
Setting poll()'s timeout argument to "required timeout" + "1 jiffy in ms" fixed it. Patch below should fix it too. Correct?
Untested.
Otherwise 2.6.24-rc5 ticks just fine here, thanks.

Karsten

------------->
Make sys_poll() wait at least timeout ms

schedule_timeout(jiffies) waits for at least jiffies - 1.
Add 1 jiffie to the timeout_jiffies calculated in sys_poll() to wait at least timeout_msecs, like poll() manpage says.

---
 fs/select.c |    2 +-
 1 files changed, 1 insertions(+), 1 deletions(-)
fs/select.c +1 -1
index 47f4792..5633fe9 100644
@@ -739,7 +739,7 @@ asmlinkage long sys_poll(struct pollfd __user *ufds, unsigned int nfds,
 			timeout_jiffies = -1;
 		else
 #endif
-			timeout_jiffies = msecs_to_jiffies(timeout_msecs);
+			timeout_jiffies = msecs_to_jiffies(timeout_msecs) + 1;
 	} else {
 		/* Infinite (< 0) or no (0) timeout */
 		timeout_jiffies = timeout_msecs;
Signature · 1 line
1.5.3.6