Re: [PATCH] [1/6] Add pselect/ppoll system call implementation

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



David Woodhouse <[email protected]> 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 [email protected]
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/

[Index of Archives]     [Kernel Newbies]     [Netfilter]     [Bugtraq]     [Photo]     [Stuff]     [Gimp]     [Yosemite News]     [MIPS Linux]     [ARM Linux]     [Linux Security]     [Linux RAID]     [Video 4 Linux]     [Linux for the blind]     [Linux Resources]
  Powered by Linux