]> xenbits.xensource.com Git - xen.git/commitdiff
make better use of mfn local variable in free_heap_pages()
authorJan Beulich <jbeulich@suse.com>
Tue, 25 Aug 2020 15:47:27 +0000 (17:47 +0200)
committerJan Beulich <jbeulich@suse.com>
Tue, 25 Aug 2020 15:47:27 +0000 (17:47 +0200)
Besides the one use that there is in the function (of the value
calculated at function entry), there are two more places where the
redundant page-to-address conversion can be avoided.

Signed-off-by: Jan Beulich <jbeulich@suse.com>
Acked-by: Julien Grall <jgrall@amazon.com>
Reviewed-by: Wei Liu <wl@xen.org>
xen/common/page_alloc.c

index 10b7aeca480a02d45806d7daae057ca480e2b9d0..4e86d7993503b83434063f67b8b9a23db0540ee1 100644 (file)
@@ -1380,7 +1380,7 @@ static void free_heap_pages(
 {
     unsigned long mask;
     mfn_t mfn = page_to_mfn(pg);
-    unsigned int i, node = phys_to_nid(page_to_maddr(pg)), tainted = 0;
+    unsigned int i, node = phys_to_nid(mfn_to_maddr(mfn)), tainted = 0;
     unsigned int zone = page_to_zone(pg);
 
     ASSERT(order <= MAX_ORDER);
@@ -1417,7 +1417,7 @@ static void free_heap_pages(
         default:
             printk(XENLOG_ERR
                    "pg[%u] MFN %"PRI_mfn" c=%#lx o=%u v=%#lx t=%#x\n",
-                   i, mfn_x(page_to_mfn(pg + i)),
+                   i, mfn_x(mfn) + i,
                    pg[i].count_info, pg[i].v.free.order,
                    pg[i].u.free.val, pg[i].tlbflush_timestamp);
             BUG();