Re: [PATCH 2/2] sched: prioritize non-migratable tasks over migratable ones

Steven Rostedt
2008-04-23T12:59:06Z

On Wed, 23 Apr 2008, Gregory Haskins wrote:

>
> There are several details for utilizing this properly.
>
> 1) During task-wake-up, we not only need to check if the priority
> preempts the current task, but we also need to check for this
> non-migratable condition. Therefore, if a non-migratable task wakes
> up and sees an equal priority migratable task already running, it
> will attempt to preempt it *if* there is a likelyhood that the
> current task will find an immediate home.
>
> 2) Tasks only get this non-migratable "priority boost" on wake-up. Any
> requeuing will result in the non-migratable task being queued to the
> end of the shared queue. This is an attempt to prevent the system
> from being completely unfair to migratable tasks during things like
> SCHED_RR timeslicing.
>
> I am sure this patch introduces potentially "odd" behavior if you
> concoct a scenario where a bunch of non-migratable threads could starve
> migratable ones given the right pattern. I am not yet convinced that
> this is a problem since we are talking about tasks of equal RT priority
> anyway, and there never is much in the way of guarantees against
> starvation under that scenario anyway. (e.g. you could come up with a
> similar scenario with a specific timing environment verses an affinity
> environment). I can be convinced otherwise, but for now I think this is
> "ok".
>

I'm not giving an Ack on this patch (not yet). My main concern here is
that this is performing on a verge of policy change. As you stated, this
is a known issue. One that can be avoided by giving RT tasks different
priorities. It is known that two tasks with the same priority fighting
for the same CPUS (even if one is migratable and one is not) has
non-deterministic behaviour.

This patch needs a bit of running through the grind to see what effects it
has before going in.

-- Steve