> -----Original Message----- > From: Jan Beulich <jbeul...@suse.com> > Sent: 29 January 2020 15:08 > To: Durrant, Paul <pdurr...@amazon.co.uk> > Cc: xen-devel@lists.xenproject.org; Andrew Cooper > <andrew.coop...@citrix.com>; George Dunlap <george.dun...@eu.citrix.com>; > Ian Jackson <ian.jack...@eu.citrix.com>; Julien Grall <jul...@xen.org>; > Konrad Rzeszutek Wilk <konrad.w...@oracle.com>; Stefano Stabellini > <sstabell...@kernel.org>; Wei Liu <w...@xen.org> > Subject: Re: [PATCH v6 2/4] mm: modify domain_adjust_tot_pages() to better > handle a zero adjustment > > On 29.01.2020 15:38, Paul Durrant wrote: > > --- a/xen/common/memory.c > > +++ b/xen/common/memory.c > > @@ -727,8 +727,7 @@ static long > memory_exchange(XEN_GUEST_HANDLE_PARAM(xen_memory_exchange_t) arg) > > (j * (1UL << exch.out.extent_order))); > > > > spin_lock(&d->page_alloc_lock); > > - drop_dom_ref = (dec_count && > > - !domain_adjust_tot_pages(d, - > dec_count)); > > + drop_dom_ref = !domain_adjust_tot_pages(d, -dec_count); > > And it's only now that I see it in this shape that it becomes > clear to me why the change above shouldn't be done, and why in > your other patch code should be written similar to the above: > The abstract model requires that the domain reference be > dropped only when ->tot_pages _transitions_ to zero. No drop > should occur if the count was already zero. Granted this may > be technically impossible in the specific case here, but the > code would still better reflect this general model, to prevent > it getting (mis-)cloned into other places. >
Ok, I guess I'll drop this and then make sure that free_domheap_pages() avoids an erroneous ref drop. Paul _______________________________________________ Xen-devel mailing list Xen-devel@lists.xenproject.org https://lists.xenproject.org/mailman/listinfo/xen-devel