From: linux-os <linux-os@chaos.analogic.com>
To: Nish Aravamudan <nish.aravamudan@gmail.com>
Cc: Andrew Morton <akpm@osdl.org>, Andrea Arcangeli <andrea@suse.de>,
kernel@kolivas.org, pavel@suse.cz, linux-kernel@vger.kernel.org
Subject: Re: dynamic-hz
Date: Tue, 14 Dec 2004 09:23:54 -0500 (EST) [thread overview]
Message-ID: <Pine.LNX.4.61.0412140914360.13406@chaos.analogic.com> (raw)
In-Reply-To: <29495f1d041213195451677dab@mail.gmail.com>
On Mon, 13 Dec 2004, Nish Aravamudan wrote:
> On Mon, 13 Dec 2004 03:25:21 -0800, Andrew Morton <akpm@osdl.org> wrote:
>> Andrea Arcangeli <andrea@suse.de> wrote:
>>>
>>> The patch only does HZ at dynamic time. But of course it's absolutely
>>> trivial to define it at compile time, it's probably a 3 liner on top of
>>> my current patch ;). However personally I don't think the three liner
>>> will worth the few seconds more spent configuring the kernel ;).
>>
>> We still have 1000-odd places which do things like
>>
>> schedule_timeout(HZ/10);
>
> Yes, yes, we do :) I replaced far more than I ever thought I could...
> There are a few issues I have with the remaining schedule_timeout()
> calls which I think fit ok with this thread... I'd especially like
> your input, Andrew, as you end up getting most of my patches from KJ.
>
> Many drivers use
>
> set_current_state(TASK_{UN,}INTERRUPTIBLE);
> schedule_timeout(1); // or some other small value < 10
>
> This may or may not hide a dependency on a particular HZ value. If the
> code is somewhat old, perhaps the author intended the task to sleep
> for 1 jiffy when HZ was equal to 100. That meants that they ended up
> sleeping for 10 ms. If the code is new, the author intends that the
> task sleeps for 1 ms (HZ==1000). The question is, what should the
> replacement be?
>
> If they really meant to use schedule_timeout(1) in the sense of
> highest resolution delay possible (the latter above), then they
> probably should just call schedule() directly. schedule_timeout(1)
> simply sets up a timer to fire off after 1 jiffy & then calls
> schedule() itself. The overhead of setting up a timer and the
> execution of schedule() itself probably means that the timer will go
> off in the middle of the schedule() call or very shortly thereafter (I
> think). In which case, it makes more sense to use schedule()
> directly...
>
> If they meant to schedule a delay of 10ms, then msleep() should be
> used in those cases. msleep() will also resolve the issues with 0-time
> timeouts because of rounding, as it adds 1 to the converted parameter.
>
> Obviously, changing more and more sleeps to msecs & secs will really
> help make the changing of HZ more transparent. And specifying the time
> in real time units just seems so much clearer to me.
>
> What do people think?
>
> -Nish
I found that if you use schedule() directly then the sleeping
task appears to be spinning in "system" in `top`. If you use
schedule_timeout(0), it works the same, but doesn't appear
to be eating CPU cycles as shown by `top`. Many common
drivers need to have the timeout interruptible, but wait
<forever if necessary> for a particular event. They need
to get the CPU back fairly often to check again for the
event. They need the equavalent of user-mode sched_yield().
sys_sched_yield() did't seem to work correctly, last time
I tried.
Maybe somebody could make a sched_yield() for the kernel.
That would improve a lot of drivers.
Cheers,
Dick Johnson
Penguin : Linux version 2.6.9 on an i686 machine (5537.79 BogoMips).
Notice : All mail here is now cached for review by John Ashcroft.
98.36% of all statistics are fiction.
next prev parent reply other threads:[~2004-12-14 14:28 UTC|newest]
Thread overview: 126+ messages / expand[flat|nested] mbox.gz Atom feed top
2004-12-11 14:23 dynamic-hz Andrea Arcangeli
2004-12-11 14:50 ` dynamic-hz Zwane Mwaikambo
2004-12-12 6:57 ` dynamic-hz Andrea Arcangeli
2004-12-11 21:41 ` dynamic-hz Jan Engelhardt
2004-12-12 16:35 ` dynamic-hz Pavel Machek
2004-12-12 22:23 ` dynamic-hz Andrea Arcangeli
2004-12-12 23:36 ` dynamic-hz Con Kolivas
2004-12-12 23:42 ` dynamic-hz Pavel Machek
2004-12-13 0:09 ` dynamic-hz Con Kolivas
2004-12-13 8:37 ` dynamic-hz Jan Engelhardt
2004-12-13 10:43 ` dynamic-hz Pavel Machek
2004-12-13 11:08 ` dynamic-hz Andrea Arcangeli
2004-12-13 19:36 ` dynamic-hz john stultz
2004-12-12 23:43 ` dynamic-hz Andrea Arcangeli
2004-12-13 0:18 ` dynamic-hz Con Kolivas
2004-12-13 0:27 ` dynamic-hz Andrea Arcangeli
2004-12-13 1:50 ` dynamic-hz Zwane Mwaikambo
2004-12-13 11:28 ` dynamic-hz Andrea Arcangeli
2004-12-13 12:43 ` dynamic-hz Pavel Machek
2004-12-13 12:58 ` dynamic-hz Andrea Arcangeli
2004-12-13 19:12 ` dynamic-hz Pavel Machek
2004-12-13 20:34 ` dynamic-hz john stultz
2004-12-13 20:49 ` dynamic-hz Pavel Machek
2004-12-14 2:04 ` dynamic-hz Andrea Arcangeli
[not found] ` <20041214013924.GB14617@atomide.com>
2004-12-14 9:37 ` dynamic-hz Pavel Machek
2004-12-14 21:18 ` dynamic-hz Tony Lindgren
2004-12-14 22:06 ` dynamic-hz Pavel Machek
2004-12-14 23:00 ` dynamic-hz linux-os
2004-12-14 23:13 ` dynamic-hz Tony Lindgren
2004-12-22 20:02 ` dynamic-hz Tony Lindgren
2004-12-14 23:04 ` dynamic-hz Tony Lindgren
2004-12-14 2:46 ` dynamic-hz Andrea Arcangeli
2004-12-14 19:24 ` dynamic-hz john stultz
2004-12-14 2:36 ` dynamic-hz Andrea Arcangeli
2004-12-14 9:39 ` dynamic-hz Pavel Machek
2004-12-14 9:59 ` dynamic-hz Pavel Machek
2004-12-14 15:25 ` dynamic-hz Andrea Arcangeli
2004-12-14 22:02 ` USB making time drift [was Re: dynamic-hz] Pavel Machek
2004-12-14 23:16 ` Andrea Arcangeli
2004-12-15 2:59 ` Gene Heskett
2004-12-15 9:17 ` Andrea Arcangeli
2004-12-15 16:44 ` Gene Heskett
2004-12-15 18:20 ` Andrea Arcangeli
2004-12-16 1:59 ` Gene Heskett
2004-12-16 11:30 ` Andrea Arcangeli
2004-12-16 12:50 ` Alan Cox
2004-12-15 20:16 ` Pavel Machek
2004-12-16 2:02 ` Gene Heskett
2004-12-15 17:03 ` Gene Heskett
2004-12-15 17:48 ` Tim Schmielau
2004-12-16 2:03 ` Gene Heskett
2004-12-16 0:58 ` Pavel Machek
2004-12-16 2:33 ` john stultz
2004-12-16 1:15 ` Time goes crazy in 2.6.9 after long cli [was Re: USB making time drift] Pavel Machek
2004-12-16 11:13 ` Andrea Arcangeli
2004-12-16 12:49 ` Alan Cox
2004-12-13 14:50 ` dynamic-hz Zwane Mwaikambo
2004-12-13 7:43 ` dynamic-hz Stefan Seyfried
2004-12-13 13:58 ` dynamic-hz Russell King
2004-12-13 14:14 ` dynamic-hz Russell King
2004-12-13 14:52 ` dynamic-hz Alan Cox
2004-12-13 16:23 ` dynamic-hz Russell King
2004-12-13 17:53 ` dynamic-hz Michael Buesch
2004-12-13 18:04 ` dynamic-hz Russell King
2004-12-13 19:04 ` dynamic-hz Pavel Machek
2004-12-13 20:11 ` dynamic-hz Russell King
2004-12-14 0:16 ` dynamic-hz Eric St-Laurent
2004-12-15 18:04 ` dynamic-hz Alan Cox
2004-12-15 19:54 ` dynamic-hz linux-os
2004-12-16 2:17 ` dynamic-hz Gene Heskett
2004-12-16 12:42 ` dynamic-hz linux-os
2004-12-17 20:12 ` dynamic-hz H. Peter Anvin
2004-12-16 9:10 ` dynamic-hz Gabriel Paubert
2004-12-16 12:17 ` dynamic-hz Geert Uytterhoeven
2004-12-16 14:00 ` dynamic-hz Mitchell Blank Jr
2004-12-13 15:30 ` dynamic-hz Zwane Mwaikambo
2004-12-13 15:59 ` dynamic-hz Russell King
2004-12-13 16:14 ` dynamic-hz Pavel Machek
2004-12-13 16:06 ` dynamic-hz Pavel Machek
2004-12-13 16:19 ` dynamic-hz Jan Engelhardt
2004-12-13 8:29 ` dynamic-hz Jan Engelhardt
2004-12-14 22:54 ` dynamic-hz Lee Revell
2004-12-14 23:38 ` dynamic-hz Chris Friesen
2004-12-15 8:32 ` dynamic-hz Jan Engelhardt
2004-12-13 11:02 ` dynamic-hz Andrew Morton
2004-12-13 11:17 ` dynamic-hz Andrea Arcangeli
2004-12-13 11:25 ` dynamic-hz Andrew Morton
2004-12-13 11:47 ` dynamic-hz Andrea Arcangeli
2004-12-14 3:56 ` dynamic-hz Nish Aravamudan
2004-12-14 3:54 ` dynamic-hz Nish Aravamudan
2004-12-14 4:29 ` dynamic-hz Andrew Morton
2004-12-14 5:25 ` dynamic-hz Nish Aravamudan
2004-12-17 20:10 ` dynamic-hz Nish Aravamudan
2004-12-14 10:01 ` dynamic-hz Domen Puncer
2004-12-14 16:56 ` dynamic-hz Nish Aravamudan
2004-12-14 14:23 ` linux-os [this message]
2004-12-14 16:54 ` dynamic-hz Nish Aravamudan
2004-12-14 17:15 ` dynamic-hz Andrea Arcangeli
2004-12-14 17:42 ` dynamic-hz Nish Aravamudan
2004-12-14 18:29 ` dynamic-hz Andrea Arcangeli
2004-12-14 19:00 ` dynamic-hz Nish Aravamudan
2004-12-14 18:22 ` dynamic-hz linux-os
2004-12-14 18:38 ` dynamic-hz Andrea Arcangeli
2004-12-14 18:50 ` dynamic-hz Pavel Machek
2004-12-13 11:19 ` dynamic-hz Hans Kristian Rosbach
2004-12-13 11:22 ` dynamic-hz Pavel Machek
2004-12-13 11:39 ` dynamic-hz Andrea Arcangeli
2004-12-13 12:51 ` dynamic-hz Hans Kristian Rosbach
2004-12-13 13:01 ` dynamic-hz Andrea Arcangeli
2004-12-13 13:02 ` dynamic-hz Andrea Arcangeli
2004-12-13 15:06 ` dynamic-hz Geert Uytterhoeven
2004-12-13 16:12 ` dynamic-hz Pavel Machek
2004-12-13 16:14 ` dynamic-hz Geert Uytterhoeven
2004-12-14 4:06 ` dynamic-hz Nish Aravamudan
2004-12-14 4:05 ` dynamic-hz Nish Aravamudan
2004-12-13 11:33 ` dynamic-hz Andrea Arcangeli
2004-12-13 14:38 ` dynamic-hz Zwane Mwaikambo
2004-12-13 12:00 ` dynamic-hz Alan Cox
2004-12-13 15:52 ` dynamic-hz Andrea Arcangeli
2004-12-14 22:28 ` dynamic-hz Lee Revell
2004-12-14 22:40 ` dynamic-hz Con Kolivas
2004-12-14 22:50 ` dynamic-hz Lee Revell
2004-12-13 20:26 ` dynamic-hz Olaf Hering
2004-12-13 22:41 ` dynamic-hz Andrea Arcangeli
2004-12-13 20:56 ` dynamic-hz john stultz
2004-12-13 22:21 ` dynamic-hz Andrea Arcangeli
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=Pine.LNX.4.61.0412140914360.13406@chaos.analogic.com \
--to=linux-os@chaos.analogic.com \
--cc=akpm@osdl.org \
--cc=andrea@suse.de \
--cc=kernel@kolivas.org \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-os@analogic.com \
--cc=nish.aravamudan@gmail.com \
--cc=pavel@suse.cz \
/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).