Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1758895AbXLSCat (ORCPT ); Tue, 18 Dec 2007 21:30:49 -0500 Received: (majordomo@vger.kernel.org) by vger.kernel.org id S1753140AbXLSCak (ORCPT ); Tue, 18 Dec 2007 21:30:40 -0500 Received: from idcmail-mo1so.shaw.ca ([24.71.223.10]:34873 "EHLO pd2mo2so.prod.shaw.ca" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1752743AbXLSCaj (ORCPT ); Tue, 18 Dec 2007 21:30:39 -0500 Date: Tue, 18 Dec 2007 20:29:34 -0600 From: Robert Hancock Subject: Re: [RFC/PATCH] 2.6.24-rcx: Make sys_poll() wait at least timeout ms In-reply-to: <200712190206.56428.fzu@wemgehoertderstaat.de> To: Karsten Wiese Cc: linux-kernel@vger.kernel.org Message-id: <4768820E.9050700@shaw.ca> MIME-version: 1.0 Content-type: text/plain; charset=ISO-8859-1; format=flowed Content-transfer-encoding: 7bit References: <47685F4B.8000207@shaw.ca> <200712190206.56428.fzu@wemgehoertderstaat.de> User-Agent: Thunderbird 2.0.0.9 (Windows/20071031) Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Length: 1351 Lines: 35 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/ -- 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/