Re: -rt more realtime scheduling issues

!MAILaRCHIVE_VOTE_RePLACE
Previous message: [thread] [date] [author]
Next message: [thread] [date] [author]
To: Mike Kravetz <kravetz@...>
Cc: Ingo Molnar <mingo@...>, Linux Kernel Mailing List <linux-kernel@...>
Date: Wednesday, October 10, 2007 - 7:50 am

On Tue, Oct 09, 2007 at 11:49:53AM -0700, Mike Kravetz wrote:

Sure, another CPU can set the tasks NEED_RESCHED flag. In try_to_wake_up,
if the process that is waking up is on a runqueue on another CPU and it
is of higher priority than the current running task, the process that is
doing the waking will set the NEED_RESCHED flag for that task.

So to prevent a race where we have called schedule and after getting to
the new running task, a higher priority process just got scheduled in,
we will catch that here.

Now if this is really needed? I don't know. It seems that it just wants
to check here so we don't need to jump to the interrupt and then
schedule while coming back out of the interrupt handler as a preemption
schedule. This way we just schedule again and save a little overhead
from doing that through the interrupt.

But this brings up an interesting point. Since the IRQ handlers are run
as threads, and the interrupt is what will wake them, this seems to add
a bit of latency to interrupts.

For example:

  We schedule in process A of prio 1

  before exiting __schedule process B is woken up on that same rq
  with a prio of 2 and sets A's NEED_RESCHED flag.

  Also an interrupt goes off and sent to this CPU. But since interrupts
  are disabled, we wait.

  leaving __schedule() we see that A's NEED_RESCHED flag is set, so we
  continue the do while loop and call __schedule again.

  We schedule in B of prio 2.

  Leave __schedule as well as the do while loop and then enable
  interrupts.

  The interrupt that was pending is now triggered.

  Wakes up the handler of prio 90 and since it is higher in priority
  than process B of prio 2 it sets B's NEED_RESCHED flag.

  On return from the interrupt we call schedule again.

This seems strange. I can imagine on a large # of CPUs box that this can
happen quite often, and have the interrupts disabled for several rounds
through schedule.

I say we ax that while loop.

Ingo?

-- Steve

-
Previous message: [thread] [date] [author]
Next message: [thread] [date] [author]

Messages in current thread:
-rt more realtime scheduling issues, Mike Kravetz, (Fri Oct 5, 10:15 pm)
[PATCH RT] fix rt-task scheduling issue, Steven Rostedt, (Mon Oct 8, 10:46 pm)
Re: [PATCH RT] fix rt-task scheduling issue, Mike Kravetz, (Tue Oct 9, 2:51 pm)
Re: [PATCH RT] fix rt-task scheduling issue, Gregory Haskins, (Tue Oct 9, 12:18 am)
Re: -rt more realtime scheduling issues, Mike Kravetz, (Mon Oct 8, 2:45 pm)
Re: -rt more realtime scheduling issues, Steven Rostedt, (Mon Oct 8, 11:04 pm)
Re: -rt more realtime scheduling issues, Mike Kravetz, (Tue Oct 9, 2:49 pm)
Re: -rt more realtime scheduling issues, Steven Rostedt, (Wed Oct 10, 7:50 am)
Re: -rt more realtime scheduling issues, Mike Kravetz, (Wed Oct 10, 10:37 pm)
Re: -rt more realtime scheduling issues, Peter Zijlstra, (Tue Oct 9, 4:16 am)