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

Re: [Xen-devel] [PATCH v5] common/vm_event: Initialize vm_event lists on domain creation



On Tue, Aug 29, 2017 at 11:38:12AM -0600, Tamas K Lengyel wrote:
> On Tue, Aug 29, 2017 at 9:59 AM, Wei Liu <wei.liu2@xxxxxxxxxx> wrote:
> > On Tue, Aug 29, 2017 at 05:17:05PM +0300, Alexandru Isaila wrote:
> > [...]
> >>
> >>  /**
> >> diff --git a/xen/common/domain.c b/xen/common/domain.c
> >> index b22aacc..30f507b 100644
> >> --- a/xen/common/domain.c
> >> +++ b/xen/common/domain.c
> >> @@ -363,9 +363,6 @@ struct domain *domain_create(domid_t domid, unsigned 
> >> int domcr_flags,
> >>          poolid = 0;
> >>
> >>          err = -ENOMEM;
> >> -        d->vm_event = xzalloc(struct vm_event_per_domain);
> >> -        if ( !d->vm_event )
> >> -            goto fail;
> >>
> >>          d->pbuf = xzalloc_array(char, DOMAIN_PBUF_SIZE);
> >>          if ( !d->pbuf )
> >> @@ -403,7 +400,6 @@ struct domain *domain_create(domid_t domid, unsigned 
> >> int domcr_flags,
> >>      if ( hardware_domain == d )
> >>          hardware_domain = old_hwdom;
> >>      atomic_set(&d->refcnt, DOMAIN_DESTROYED);
> >> -    xfree(d->vm_event);
> >>      xfree(d->pbuf);
> >>      if ( init_status & INIT_arch )
> >>          arch_domain_destroy(d);
> >> @@ -820,7 +816,14 @@ static void complete_domain_destroy(struct rcu_head 
> >> *head)
> >>      free_xenoprof_pages(d);
> >>  #endif
> >>
> >> -    xfree(d->vm_event);
> >> +#ifdef CONFIG_HAS_MEM_PAGING
> >> +    xfree(d->vm_event_paging);
> >> +#endif
> >> +    xfree(d->vm_event_monitor);
> >
> > Why do you unconditionally xfree these vm_event_monitor while you don't
> > unconditionally allocate them?
> >
> > Not that this is strictly a bug but this deviates from the original
> > behaviour.
> 
> Isn't xfree NULL safe?

Yes, it is.

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

 


Rackspace

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