Re: static scheduling - SCHED_IDLE?

Philipp Rumpf
2001-03-14T14:28:25Z

On Fri, Mar 09, 2001 at 09:09:13PM +0100, Jamie Lokier wrote:
> Rik van Riel wrote:
> > > Just raise the priority whenever the task's in kernel mode. Problem
> > > solved.
> >
> > Remember that a task schedules itself out at the timer interrupt,
> > in kernel/sched.c::schedule() ... which is kernel mode ;)
>
> Even nicer. On x86 change this:
>
> reschedule:
> call SYMBOL_NAME(schedule) # test
> jmp ret_from_sys_call
>
> to this:
>
> reschedule:
> orl $PF_HONOUR_LOW_PRIORITY,flags(%ebx)
> call SYMBOL_NAME(schedule) # test
> andl $~PF_HONOUR_LOW_PRIORITY,flags(%ebx)
> jmp ret_from_sys_call
>
> (You get the idea; this isn't the best implementation).

A few months ago, I implemented preemptible kernel threads (locally; I
tend to think the other patches are superior). Part of the changes was
to separate schedule into __schedule() (common part), schedule_user()
(automatic schedule from entry.S) and schedule() (manual schedule in
kernel space); besides making what Jamie proposed easier, we can also
save a few cycles in the (common) schedule_user case:

- we never release the kernel lock
- we can pass current to schedule_user
- we just handled softirqs

this is 2.5 material though ...