Re: select takes too much time

From: Nish Aravamudan
Date: Thu Apr 13 2006 - 17:19:07 EST


On 4/13/06, linux-os (Dick Johnson) <linux-os@xxxxxxxxxxxx> wrote:
>
> On Thu, 13 Apr 2006, Ram Gupta wrote:
>
> > On 4/13/06, Michal Schmidt <xschmi00@xxxxxxxxxxxxxxxxxx> wrote:
> >> Ram Gupta wrote:
> >>> I am using 2.5.45 kernel but I believe the same would be the true
> >>> for the latest kernel too.
> >>
> >> Are you just assuming this, or did you actually try a recent kernel?
> >>
> >> Michal
> >>
> >
> > I didn't get a chance to try it on a recent kernel yet but I believe
> > it to be so though I may be wrong
> >
> > Ram
> > -
>
> Simple program here shows that you may be right! In principle,
> I should be able to multiply the loop-count by 10 and divide
> the sleep time by 10, still resulting in 1-second total time
> through the loop. Not so! Changing the value, marked "Change this" to
> a smaller value doesn't affect the time very much. It is as though
> the sleep time is always at least 1000 microseconds. If this is
> correct, then there should be some kind of warning that the time
> can't be less than the HZ value, or whatever is limiting it.

Doesn't sys_select() just use schedule_timeout() eventually? <checks>
yes, sys_select() -> core_sys_select() -> do_select() ->
schedule_timeout(). Presuming there is any value stored in the timeout
parameter, you're going to sleep at least a jiffy which is 1/HZ. If
HZ=1000 (or 1024), I'd guess that 1000 us as a minimum would be
expected.

Thanks,
Nish
-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/