[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] Re: [Xen-devel] [PATCH 3/6] xen/sched: Improvements to the {alloc, free}_domdata() interfaces
On Wed, Feb 28, 2018 at 9:14 AM, Andrew Cooper <andrew.cooper3@xxxxxxxxxx> wrote: > > The main purpose of this change is for the subsequent cleanup it enables, but > it stands on its own merits. > > In principle, these hooks are optional, but the SCHED_OP() default aliases a > memory allocation failure, which causes arinc653 to play the dangerous game of > passing its priv pointer back, and remembering not to actually free it. > > Redefine alloc_domdata to use ERR_PTR() for errors, NULL for nothing, and > non-NULL for a real allocation, which allows the hook to become properly > optional. Redefine free_domdata to be idempotent. > > For arinc653, this means the dummy hooks can be dropped entirely. For the > other schedulers, this means returning ERR_PTR(-ENOMEM) instead of NULL for > memory allocation failures, and modifying the free hooks to cope with a NULL > pointer. While making the alterations, drop some spurious casts to void *. > > Introduce and use proper wrappers for sched_{alloc,free}_domdata(). These are > strictly better than SCHED_OP(), as the source code is visible to > grep/cscope/tags, the generated code is better, and there can be proper > per-hook defaults and checks. > > Callers of the alloc hooks are switched to using IS_ERR(), rather than > checking for NULL. > > Signed-off-by: Andrew Cooper <andrew.cooper3@xxxxxxxxxx> > --- Acked-by: Meng Xu <mengxu@xxxxxxxxxxxxx> Thanks, Meng ----------- Meng Xu Ph.D. Candidate in Computer and Information Science University of Pennsylvania http://www.cis.upenn.edu/~mengxu/ _______________________________________________ Xen-devel mailing list Xen-devel@xxxxxxxxxxxxxxxxxxxx https://lists.xenproject.org/mailman/listinfo/xen-devel
|
Lists.xenproject.org is hosted with RackSpace, monitoring our |