Re: [PATCH][KVM][retry 3] Add support for Pause Filtering to AMDSVM
From: Peter Zijlstra
Date: Wed May 20 2009 - 03:59:59 EST
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 linux-kernel" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/