[Libvir] [PATCH][RFC] shows scheduler information

Daniel P. Berrange berrange at redhat.com
Mon Apr 2 13:19:47 UTC 2007

On Mon, Apr 02, 2007 at 04:10:53PM +0900, Atsushi SAKAI wrote:
> Hi, Daniel and Rich
> Thanks for various comments.
> Qemu and Qemu with KVM uses default Linux scheduler.
> (struct sched_param)
> And Xen uses original scheduler.
> At this moment, we should support xen (sedf, credit) and 
> Linux scheduler(sched_param).
> Is this enough?
> Or We should consider other parameters from Linux scheduler API?
> (Realtime etc...)
> Anyway this should be Linux scheduler related issue.
> So we should define Linux scheduler related struct for qemu related issue.

I don't think using structs with explicit members for each schedular parameter
is viable over the long term. We have already seen Xen go through 3 different
schedulars over the course of 1+1/2 years, each one requiring different
parameters. I wouldn't be at all surprised it more changes appear in the
next 1+1/2 years because the Xen schedular is really very young/immature at
this time. 

I think it is unavoidable that every impl is going to express the schedular 
parameters in a completely different way. Thus if we're going to have an API 
for fetching/updating schedular parameters then I think we need to have a 
weakly typed system which is extensible to an new arbitrary fields without 
requiring any API changes. Applications themselves will obviously have to be
updated to understand any new schedular types that come along, but as I said
before I think this is unavoidable unless we crippled the API to make it look

    enum {

    struct virDomainSchedParameter {
      int type;
      union {
        int i;
        long long int l;
        double d;
        char b;
      } value;

    typedef struct virDomainSchedParameter virDomainSchedParameter;

And each the API take an array of these eg

     /* Return schedular type in effect  'sedf', 'credit', 'linux' */
     const char *virDomainGetSchedularType(virDomainPtr conn);
     /* Fetch schedular parameters, caller allocates 'params' field of size 'nparams' */
     int virDomainGetSchedularParameters(virDomainPtr dom, virSchedParameter *params, int nparams);
     /* Change schedular parameters */
     int virDomainSetSchedularParameters(virDomainPtr dom, virSchedParameter *params, int nparams);

Linux only appears to have 2 schedula parameters at this time - 'priority' and 'type' thje
latter being one of FIFO, RR, Other, Batch.

|=- Red Hat, Engineering, Emerging Technologies, Boston.  +1 978 392 2496 -=|
|=-           Perl modules: http://search.cpan.org/~danberr/              -=|
|=-               Projects: http://freshmeat.net/~danielpb/               -=|
|=-  GnuPG: 7D3B9505   F3C9 553F A1DA 4AC2 5648 23C1 B3DF F742 7D3B 9505  -=| 

More information about the libvir-list mailing list