[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] Re: [Xen-devel] [PATCH RFC] xen/balloon: check whether a page is pointed to scratch page MFN
On Thu, Sep 05, 2013 at 03:21:32PM +0100, Stefano Stabellini wrote: > On Thu, 5 Sep 2013, Wei Liu wrote: > > Now that balloon pages might have two kind of P2M entries, a) > > INVALID_P2M_ENTRY when that page is never used, b) mfn of one of the > > many ballooned scratch pages. Refelct this in increase_reservation to > > avoid hitting BUG_ON. > > > > Signed-off-by: Wei Liu <wei.liu2@xxxxxxxxxx> > > --- > > drivers/xen/balloon.c | 21 ++++++++++++++++++++- > > 1 file changed, 20 insertions(+), 1 deletion(-) > > > > diff --git a/drivers/xen/balloon.c b/drivers/xen/balloon.c > > index 3101cf6..63a7e5e 100644 > > --- a/drivers/xen/balloon.c > > +++ b/drivers/xen/balloon.c > > @@ -305,6 +305,24 @@ static enum bp_state reserve_additional_memory(long > > credit) > > } > > #endif /* CONFIG_XEN_BALLOON_MEMORY_HOTPLUG */ > > > > +static bool p2m_is_ballooned_scratch_page(unsigned long pfn) > > +{ > > + int cpu; > > + unsigned long bpfn; > > + struct page *bpage; > > + > > + for_each_possible_cpu(cpu) { > > + bpage = per_cpu(balloon_scratch_page, cpu); > > + if (!bpage) > > + continue; > > + bpfn = page_to_pfn(bpage); > > + if (pfn_to_mfn(pfn) == pfn_to_mfn(bpfn)) > > Even though it is true that this function doesn't need to be very fast, > we might as well try to write in an efficient way. > For example it might be worth calculating pfn_to_mfn(pfn) just once > outside the loop? > Good point. _______________________________________________ Xen-devel mailing list Xen-devel@xxxxxxxxxxxxx http://lists.xen.org/xen-devel
|
Lists.xenproject.org is hosted with RackSpace, monitoring our |