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

[Xen-changelog] [xen master] memory: polish populate_physmap()



commit c4b6bbe2240f5d3b22245bee9f4ceb3698e78ef9
Author:     Jan Beulich <jbeulich@xxxxxxxx>
AuthorDate: Wed Sep 23 11:12:24 2015 +0200
Commit:     Jan Beulich <jbeulich@xxxxxxxx>
CommitDate: Wed Sep 23 11:12:24 2015 +0200

    memory: polish populate_physmap()
    
    Adjust types, avoid a NULL check for a case where it's not needed, and
    simplify setting a variable on the alternative path.
    
    Signed-off-by: Jan Beulich <jbeulich@xxxxxxxx>
    Reviewed-by: Andrew Cooper <andrew.cooper3@xxxxxxxxxx>
    Acked-by: Ian Campbell <ian.campbell@xxxxxxxxxx>
---
 xen/common/memory.c |   28 ++++++++++++++++------------
 1 files changed, 16 insertions(+), 12 deletions(-)

diff --git a/xen/common/memory.c b/xen/common/memory.c
index b541f4a1..f6aed0d 100644
--- a/xen/common/memory.c
+++ b/xen/common/memory.c
@@ -92,7 +92,7 @@ static void increase_reservation(struct memop_args *a)
 static void populate_physmap(struct memop_args *a)
 {
     struct page_info *page;
-    unsigned long i, j;
+    unsigned int i, j;
     xen_pfn_t gpfn, mfn;
     struct domain *d = a->domain;
 
@@ -147,27 +147,31 @@ static void populate_physmap(struct memop_args *a)
                     put_page(page);
                 }
 
-                page = mfn_to_page(gpfn);
+                mfn = gpfn;
+                page = mfn_to_page(mfn);
             }
             else
+            {
                 page = alloc_domheap_pages(d, a->extent_order, a->memflags);
 
-            if ( unlikely(page == NULL) ) 
-            {
-                if ( !opt_tmem || (a->extent_order != 0) )
-                    gdprintk(XENLOG_INFO, "Could not allocate order=%d extent:"
-                             " id=%d memflags=%x (%ld of %d)\n",
-                             a->extent_order, d->domain_id, a->memflags,
-                             i, a->nr_extents);
-                goto out;
+                if ( unlikely(!page) )
+                {
+                    if ( !opt_tmem || a->extent_order )
+                        gdprintk(XENLOG_INFO,
+                                 "Could not allocate order=%u extent: id=%d 
memflags=%#x (%u of %u)\n",
+                                 a->extent_order, d->domain_id, a->memflags,
+                                 i, a->nr_extents);
+                    goto out;
+                }
+
+                mfn = page_to_mfn(page);
             }
 
-            mfn = page_to_mfn(page);
             guest_physmap_add_page(d, gpfn, mfn, a->extent_order);
 
             if ( !paging_mode_translate(d) )
             {
-                for ( j = 0; j < (1 << a->extent_order); j++ )
+                for ( j = 0; j < (1U << a->extent_order); j++ )
                     set_gpfn_from_mfn(mfn + j, gpfn + j);
 
                 /* Inform the domain of the new page's machine address. */ 
--
generated by git-patchbot for /home/xen/git/xen.git#master

_______________________________________________
Xen-changelog mailing list
Xen-changelog@xxxxxxxxxxxxx
http://lists.xensource.com/xen-changelog


 


Rackspace

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