Juergen Gross, on Fri 05 Aug 2016 19:36:01 +0200, wrote: > +#define N_BALLOON_FRAMES 64 > +static unsigned long balloon_frames[N_BALLOON_FRAMES]; > + > +int balloon_up(unsigned long n_pages) > +{ > + unsigned long page, pfn; > + int rc; > + struct xen_memory_reservation reservation = { > + .address_bits = 0, > + .extent_order = 0, > + .domid = DOMID_SELF > + }; > + > + if ( n_pages > nr_max_pages - nr_mem_pages ) > + n_pages = nr_max_pages - nr_mem_pages; > + if ( n_pages > N_BALLOON_FRAMES ) > + n_pages = N_BALLOON_FRAMES; > + > + /* Resize alloc_bitmap if necessary. */ > + if ( alloc_bitmap_size * 8 < nr_mem_pages + n_pages )
To be on the safe side, I'd say use a while here, even if the value of N_BALLOON_FRAMES is so that there'll always be one iteration ATM. Otherwise it looks good, Reviewed-By: Samuel Thibault <samuel.thiba...@ens-lyon.org> Samuel _______________________________________________ Xen-devel mailing list Xen-devel@lists.xen.org https://lists.xen.org/xen-devel