lkml.org 
[lkml]   [2006]   [Jan]   [13]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
Patch in this message
/
Date
From
SubjectRe: [PATCH] [1/6] Add pselect/ppoll system call implementation
David Woodhouse <dwmw2@infradead.org> wrote:
>
> This patch adds the pselect() and ppoll() system calls, providing core
> routines usable by the original select() and poll() system calls and
> also the new calls (with their semantics w.r.t timeouts).

This patch sends python into a busywait:

root 2041 98.6 0.4 11192 4656 ? R 02:36 5:29 python ./hpssd.py

strace says:

select(6, [4 5], [], [], {0, 500000}) = 0 (Timeout)
select(6, [4 5], [], [], {0, 500000}) = 0 (Timeout)
select(6, [4 5], [], [], {0, 500000}) = 0 (Timeout)
select(6, [4 5], [], [], {0, 500000}) = 0 (Timeout)
select(6, [4 5], [], [], {0, 500000}) = 0 (Timeout)
select(6, [4 5], [], [], {0, 500000}) = 0 (Timeout)
select(6, [4 5], [], [], {0, 500000}) = 0 (Timeout)
select(6, [4 5], [], [], {0, 500000}) = 0 (Timeout)
select(6, [4 5], [], [], {0, 500000}) = 0 (Timeout)
select(6, [4 5], [], [], {0, 500000}) = 0 (Timeout)
select(6, [4 5], [], [], {0, 500000}) = 0 (Timeout)
select(6, [4 5], [], [], {0, 500000}) = 0 (Timeout)
select(6, [4 5], [], [], {0, 500000}) = 0 (Timeout)
select(6, [4 5], [], [], {0, 500000}) = 0 (Timeout)
select(6, [4 5], [], [], {0, 500000}) = 0 (Timeout)
select(6, [4 5], [], [], {0, 500000}) = 0 (Timeout)
select(6, [4 5], [], [], {0, 500000}) = 0 (Timeout)
select(6, [4 5], [], [], {0, 500000}) = 0 (Timeout)
select(6, [4 5], [], [], {0, 500000}) = 0 (Timeout)


The below fixes it.

A few slipups here, so please can you re-review the code that lands in next
-mm, make sure we got everything?


--- devel/fs/select.c~add-pselect-ppoll-system-call-implementation-fix 2006-01-13 03:24:53.000000000 -0800
+++ devel-akpm/fs/select.c 2006-01-13 03:30:27.000000000 -0800
@@ -390,7 +390,7 @@ asmlinkage long sys_select(int n, fd_set
if ((u64)tv.tv_sec >= (u64)MAX_INT64_SECONDS)
timeout = -1; /* infinite */
else {
- timeout = ROUND_UP(tv.tv_sec, 1000000/HZ);
+ timeout = ROUND_UP(tv.tv_usec, USEC_PER_SEC/HZ);
timeout += tv.tv_sec * HZ;
}
}
@@ -441,7 +441,7 @@ asmlinkage long sys_pselect7(int n, fd_s
if ((u64)ts.tv_sec >= (u64)MAX_INT64_SECONDS)
timeout = -1; /* infinite */
else {
- timeout = ROUND_UP(ts.tv_sec, 1000000000/HZ);
+ timeout = ROUND_UP(ts.tv_nsec, NSEC_PER_SEC/HZ);
timeout += ts.tv_sec * HZ;
}
}
@@ -723,7 +723,7 @@ asmlinkage long sys_ppoll(struct pollfd
if ((u64)ts.tv_sec >= (u64)MAX_INT64_SECONDS)
timeout = -1; /* infinite */
else {
- timeout = ROUND_UP(ts.tv_sec, 1000000000/HZ);
+ timeout = ROUND_UP(ts.tv_nsec, NSEC_PER_SEC/HZ);
timeout += ts.tv_sec * HZ;
}
}
_
-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/

\
 
 \ /
  Last update: 2006-01-13 12:44    [W:0.059 / U:0.616 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site