[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [Xen-devel] [PATCH RFC v1 2/4] xl for rt scheduler



On ven, 2014-07-11 at 10:59 -0400, Meng Xu wrote:


>         > +    libxl_domain_sched_params_init(&scinfo);
>         > +    rc = sched_domain_get(LIBXL_SCHEDULER_RT, domid,
>         &scinfo);
>         > +    if (rc)
>         > +        return rc;
>         > +

> âThank you very much for pasting the rules here! I really appreciate
> it. However, I didn't quite get why it violate the libxl type paradigm
> and how I should correct it. (Sorry. :-()â
> 
<<The user must always calls "dispose" exactly once afterwards, to clean
up, regardless of whether operations on this object succeeded or
failed>>

While, above, you're exiting, if rc is true, without calling dispose.

It depens a lot on the function, but what you usually do, is grouping
the calls to the various dispose under a label (typically 'out:') and
goto there to exit.

Look around, both in xl and libxl, you'll find plenty of examples of
that.

> We actually followed the way credit scheduler does
> in main_sched_credit(int argc, char **argv)
> 
> 
>         } else { /* set credit scheduler paramaters */
>             libxl_domain_sched_params scinfo;
>             libxl_domain_sched_params_init(&scinfo);
>             scinfo.sched = LIBXL_SCHEDULER_CREDIT;
>             if (opt_w)
>                 scinfo.weight = weight;
>             if (opt_c)
>                 scinfo.cap = cap;
>             rc = sched_domain_set(domid, &scinfo);
>             libxl_domain_sched_params_dispose(&scinfo);
> 
And in fact, here's dispose! :-)

Dario

-- 
<<This happens because I choose it to happen!>> (Raistlin Majere)
-----------------------------------------------------------------
Dario Faggioli, Ph.D, http://about.me/dario.faggioli
Senior Software Engineer, Citrix Systems R&D Ltd., Cambridge (UK)

Attachment: signature.asc
Description: This is a digitally signed message part

_______________________________________________
Xen-devel mailing list
Xen-devel@xxxxxxxxxxxxx
http://lists.xen.org/xen-devel

 


Rackspace

Lists.xenproject.org is hosted with RackSpace, monitoring our
servers 24x7x365 and backed by RackSpace's Fanatical Support®.