[libvirt] [PATCH v2 1/3] util: Add virProcessSetScheduler() function for scheduler settings

Peter Krempa pkrempa at redhat.com
Thu Feb 12 09:18:01 UTC 2015


On Tue, Feb 10, 2015 at 16:35:19 +0100, Martin Kletzander wrote:
> This function uses sched_setscheduler() function so it works with
> processes and threads as well (even threads not created by us, which is
> what we'll need in the future).
> 
> Signed-off-by: Martin Kletzander <mkletzan at redhat.com>
> ---
>  configure.ac             |   4 +-
>  src/libvirt_private.syms |   1 +
>  src/util/virprocess.c    | 104 ++++++++++++++++++++++++++++++++++++++++++++++-
>  src/util/virprocess.h    |  20 ++++++++-
>  4 files changed, 124 insertions(+), 5 deletions(-)
> 

...

> +#if HAVE_SCHED_SETSCHEDULER
> +
> +static int
> +virProcessSchedTranslatePolicy(virProcessSchedPolicy policy)
> +{
> +    switch (policy) {
> +    case VIR_PROC_POLICY_NONE:
> +        return SCHED_OTHER;
> +
> +    case VIR_PROC_POLICY_BATCH:
> +        return SCHED_BATCH;
> +
> +    case VIR_PROC_POLICY_IDLE:
> +        return SCHED_IDLE;
> +
> +    case VIR_PROC_POLICY_FIFO:
> +        return SCHED_FIFO;
> +
> +    case VIR_PROC_POLICY_RR:
> +        return SCHED_RR;
> +
> +    case VIR_PROC_POLICY_LAST:
> +        /* nada */

I know I'm late with this comment, but:

I don't think the _LAST case is so obscure that we would need to comment
it with such an insightful comment.

> +        break;
> +    }
> +
> +    return -1;
> +}
> +

Peter
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 819 bytes
Desc: Digital signature
URL: <http://listman.redhat.com/archives/libvir-list/attachments/20150212/8f6c80a6/attachment-0001.sig>


More information about the libvir-list mailing list