Re: [PATCH] 2.5: don't miss a preemption

Robert Love (rml@tech9.net)
15 Apr 2002 17:25:24 -0400


On Mon, 2002-04-15 at 16:50, Hugh Dickins wrote:

> On 15 Apr 2002, Robert Love wrote:
> >
> > This patch checks for need_resched in preempt_schedule after setting
> > preempt_count back to zero, before returning. The overhead is
> > negligible and it is crucial to never miss a preemption opportunity.
>
> I'm curious: why is it crucial to never miss a preemption opportunity?

Two main reasons:

(1) In 2.5, we have a kernel preemption model that makes the
fully preemptible, subject to SMP locking constraints and
a few other rules. Without this patch, we break this model
and do not allow preemption when it is in fact legal.

(2) Like I said, it may be awhile before we can preempt again.
If we take a lock after return from schedule but before the
next interrupt, it can be many tens (or hundreds) of milliseconds
before we release the lock and subsequently preempt. If
need_resched was set in response to an important real-time
application, the wait can be detrimental. Servicing apps
as soon as they become runnable is the point of preempt-kernel,
anyhow.

It is not crucial in the sense we break anything; merely that we are
working toward providing very efficient response and dispatch to
interactive and real-time applications and we _must_ respond to them as
soon as possible.

Robert Love

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