linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Andrew Morton <akpm@osdl.org>
To: David Woodhouse <dwmw2@infradead.org>
Cc: torvalds@osdl.org, linux-kernel@vger.kernel.org, drepper@redhat.com
Subject: Re: [PATCH] [1/6] Add pselect/ppoll system call implementation
Date: Fri, 13 Jan 2006 03:40:58 -0800	[thread overview]
Message-ID: <20060113034058.066a2a8b.akpm@osdl.org> (raw)
In-Reply-To: <1136924299.3435.103.camel@localhost.localdomain>

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;
 		}
 	}
_


  reply	other threads:[~2006-01-13 11:41 UTC|newest]

Thread overview: 18+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
     [not found] <1136923488.3435.78.camel@localhost.localdomain>
2006-01-10 20:18 ` [PATCH] [1/6] Add pselect/ppoll system call implementation David Woodhouse
2006-01-13 11:40   ` Andrew Morton [this message]
2006-01-10 20:18 ` [PATCH] [2/6] TIF_RESTORE_SIGMASK support for arch/powerpc David Woodhouse
2006-01-10 20:18 ` [PATCH] [3/6] Generic sys_rt_sigsuspend() David Woodhouse
2006-01-10 20:19 ` [PATCH] [4/6] Handle TIF_RESTORE_SIGMASK for FRV David Woodhouse
2006-01-10 20:19 ` [PATCH] [5/6] Handle TIF_RESTORE_SIGMASK for i386 David Woodhouse
2006-01-13  3:59   ` Andrew Morton
2006-01-13  4:30     ` David Woodhouse
2006-01-13  4:54       ` Andrew Morton
2006-01-13  5:11         ` David Woodhouse
2006-01-13  6:10         ` Andrew Morton
2006-01-13  6:23           ` David Woodhouse
2006-01-13  8:28             ` David Woodhouse
2006-01-13  8:48               ` Andrew Morton
2006-01-13  8:51                 ` Andrew Morton
2006-01-13  9:18               ` Andrew Morton
2006-01-10 20:23 ` [PATCH] [6/6] Add pselect/ppoll system calls on i386 David Woodhouse
     [not found] <1134732739.7104.54.camel@pmac.infradead.org>
2005-12-16 11:43 ` [PATCH] [1/6] Add pselect/ppoll system call implementation David Woodhouse

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20060113034058.066a2a8b.akpm@osdl.org \
    --to=akpm@osdl.org \
    --cc=drepper@redhat.com \
    --cc=dwmw2@infradead.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=torvalds@osdl.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).