Skip to contentSkip to conversation

Fix PoD cache size when decreasing memory

PATCH New George Dunlap 1 participant 1 message Sep 3, 2009

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 Fix PoD cache size when decreasing memory

Certain paths through p2m_pod_decrease_reservation() fail to reduce the size of the PoD cache if the number of outstanding entries is less than the size of the cache. Rearrange so this doesn't happen.

xen/arch/x86/mm/p2m.c +7 -6
diff -r 8f81bdd57afe xen/arch/x86/mm/p2m.c
@@ -634,7 +634,7 @@
         p2md->pod.entry_count-=(1<<order); /* Lock: p2m */
         BUG_ON(p2md->pod.entry_count < 0);
         ret = 1;
-        goto out_unlock;
+        goto out_entry_check;
     }
 
     /* FIXME: Steal contig 2-meg regions for cache */
@@ -678,6 +678,12 @@
         }
     }    
 
+    /* If there are no more non-PoD entries, tell decrease_reservation() that
+     * there's nothing left to do. */
+    if ( nonpod == 0 )
+        ret = 1;
+
+out_entry_check:
     /* If we've reduced our "liabilities" beyond our "assets", free some */
     if ( p2md->pod.entry_count < p2md->pod.count )
     {
@@ -685,11 +691,6 @@
         p2m_pod_set_cache_target(d, p2md->pod.entry_count);
     }
 
-    /* If there are no more non-PoD entries, tell decrease_reservation() that
-     * there's nothing left to do. */
-    if ( nonpod == 0 )
-        ret = 1;
-
 out_unlock:
     audit_p2m(d);
     p2m_unlock(p2md);

_______________________________________________
Xen-devel mailing list
[email protected]
http://lists.xensource.com/xen-devel