Re: [PATCH] qemu-kvm: response to SIGUSR1 to start/stop a VCPU (v2)

Peter Zijlstra
2010-12-01T17:44:54Z

On Wed, 2010-12-01 at 22:59 +0530, Srivatsa Vaddagiri wrote:
>
> yield_task_fair(...)
> {
>
> + ideal_runtime = sched_slice(cfs_rq, curr);
> + delta_exec = curr->sum_exec_runtime - curr->prev_sum_exec_runtime;
> + rem_time_slice = ideal_runtime - delta_exec;
> +
> + current->donate_time += rem_time_slice > some_threshold ?
> + some_threshold : rem_time_slice;
>
> ...
> }
>
>
> sched_slice(...)
> {
> slice = ...
>
> + slice += current->donate_time;
>
> }
>
> or something close to it. I am bit reluctant to go that route myself, unless the
> fairness issue with plain yield is quite bad.

That really won't do anything. You need to adjust both tasks their
vruntime. Also, I really wouldn't touch the yield() implementation, nor
would I expose any such time donation crap to userspace.