On Tue, 2009-05-19 at 13:56 -0500, Mark Langsdorf wrote:
> @@ -1947,6 +1947,11 @@ task_hot(struct task_struct *p, u64 now, struct 
> sched_domain *sd)
>         return delta < (s64)sysctl_sched_migration_cost;
>  }
>  
> +void set_task_delay(struct task_struct *p, unsigned int delay)
> +{
> +       p->se.vruntime += delay;
> +}
> +EXPORT_SYMBOL(set_task_delay);

That's broken, you cannot assume that a task is SCHED_OTHER like that.

Furthermore, you cannot simply change vruntime of any odd task, this
only works for current. Also, you really need to call schedule() after
doing this for it to have any immediate effect.

Also, if you mean delay to be ns, you need to scale it. Furthermore, I
would really really want to export this as GPL only (ok, preferably not
at all).

That said, I still thoroughly dislike this whole approach.


/*
 * Dumb broken yield like interface -- use at your own peril and know
 * RT people will hate you.
 *
 * Like yield, except for SCHED_OTHER/BATCH, where it will give up @ns
 * time for the 'good' cause.
 */
void sched_delay_yield(unsigned long ns)
{
        struct task_struct *curr = current;

        if (curr->sched_class == &fair_sched_class) {
                struct sched_entity *se = &curr->se;
                __update_curr(cfs_rq_of(se), se, ns);
                schedule();
                /* XXX: task accounting ? */
        } else
                sched_yield();
}
EXPORT_SYMBOL_GPL(sched_delay_yield);
--
To unsubscribe from this list: send the line "unsubscribe kvm" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html

Reply via email to