Subject: Re: Scheduler API changes for yamt-idlelwp
To: YAMAMOTO Takashi <>
From: Daniel Sieger <dsieger@TechFak.Uni-Bielefeld.DE>
List: tech-kern
Date: 02/21/2007 18:06:48
On Wed, Feb 21, 2007 at 08:06:25PM +0900, YAMAMOTO Takashi wrote:
> > To sum this up: I don't think leaving schedcpu() as it is will lead to
> > too much code duplication. Not all schedulers will need schedcpu() in
> > its current incarnation. And it is IMHO the most clean solution for
> > the moment.
> > 
> > What do you think?
> "for the moment" means you have some ideas for long term?

Yeah. At least, there's one which immediately comes to my mind: Every
scheduler will need something like 4BSD's schedcpu() in order to
update p_pctcpu and other things. So, I think it would be good to add
a function like sched_update_pstats() or just simply sched_update()
to the API. schedcpu() could, if desired, even remain unchanged, as it
is not called from outside the scheduler.

Other alternatives don't seem very attractive to me:

1. Use #ifdefs, which is ugly.
2. Using a scheduler-specific hook. I don't like the idea to add "Yet
   Another Scheduler Hook", if not absolutely necessary. And I'm not
   sure it would work at all, since 4BSD specific stuff is spread all
   over various places in schedcpu().

Considering those alternatives, adding sched_update() is propably the
cleanest solution. Opinions? Other suggestions?


Daniel Sieger
Faculty of Technology
Bielefeld University