public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
From: Robert Hancock <hancockr@shaw.ca>
To: Karsten Wiese <fzu@wemgehoertderstaat.de>
Cc: linux-kernel@vger.kernel.org
Subject: Re: [RFC/PATCH] 2.6.24-rcx: Make sys_poll() wait at least timeout ms
Date: Tue, 18 Dec 2007 20:29:34 -0600	[thread overview]
Message-ID: <4768820E.9050700@shaw.ca> (raw)
In-Reply-To: <200712190206.56428.fzu@wemgehoertderstaat.de>

Karsten Wiese wrote:
> Am Mittwoch, 19. Dezember 2007 schrieb Robert Hancock:
>> That seems fishy. What is your value of HZ and what is the timeout value 
>> that was passed in the bad case?
> 
> HZ set to 250, timeout to 4ms.
> Time spent in poll() taken by clock_gettime(CLOCK_MONOTONIC, &time)
> before and after poll()call: i.e 62us.
> Time measured with hpet gave 166us once.

msecs_to_jiffies (kernel/time.c) has this:

#if HZ <= MSEC_PER_SEC && !(MSEC_PER_SEC % HZ)
	/*
	 * HZ is equal to or smaller than 1000, and 1000 is a nice
	 * round multiple of HZ, divide with the factor between them,
	 * but round upwards:
	 */
	return (m + (MSEC_PER_SEC / HZ) - 1) / (MSEC_PER_SEC / HZ);

With HZ=250 and m=4 this gives 7/4 or only 1 jiffy, which is not more 
than 4ms, but if we are already at near the end of the current jiffy it 
could be much less than that (potentially almost no time at all).

Maybe we could convert poll to use a hrtimer for this instead?

-- 
Robert Hancock      Saskatoon, SK, Canada
To email, remove "nospam" from hancockr@nospamshaw.ca
Home Page: http://www.roberthancock.com/

  reply	other threads:[~2007-12-19  2:30 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
     [not found] <fa.QbT8/KZb1MTA5+n7SD6kFi6mqso@ifi.uio.no>
2007-12-19  0:01 ` [RFC/PATCH] 2.6.24-rcx: Make sys_poll() wait at least timeout ms Robert Hancock
2007-12-19  1:06   ` Karsten Wiese
2007-12-19  2:29     ` Robert Hancock [this message]
2007-12-19 12:55       ` Karsten Wiese
2007-12-18 17:31 Karsten Wiese

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=4768820E.9050700@shaw.ca \
    --to=hancockr@shaw.ca \
    --cc=fzu@wemgehoertderstaat.de \
    --cc=linux-kernel@vger.kernel.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