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

[Xen-ia64-devel] [patch] small speedup to boot allocator


  • To: xen-ia64-devel@xxxxxxxxxxxxxxxxxxx
  • From: Jes Sorensen <jes@xxxxxxx>
  • Date: Tue, 26 Sep 2006 17:04:22 +0200
  • Delivery-date: Tue, 26 Sep 2006 08:04:45 -0700
  • List-id: Discussion of the ia64 port of Xen <xen-ia64-devel.lists.xensource.com>

Hi,

This is a small speedup, but I think it's a good thing to do<tm>.

Jes

Small speedup for the boot allocator to avoid it scanning through a
space which is known to be empty.

Signed-off-by: Jes Sorensen <jes@xxxxxxx>


diff -r 7b250cf49e50 xen/common/page_alloc.c
--- a/xen/common/page_alloc.c   Sun Sep 24 14:55:57 2006 -0600
+++ b/xen/common/page_alloc.c   Mon Sep 25 18:47:57 2006 +0200
@@ -112,6 +117,7 @@ static void map_alloc(unsigned long firs
     }
 }
 
+static unsigned long first_pg = -1UL;
 
 static void map_free(unsigned long first_page, unsigned long nr_pages)
 {
@@ -128,6 +134,10 @@ static void map_free(unsigned long first
     start_off = first_page & (PAGES_PER_MAPWORD-1);
     end_idx   = (first_page + nr_pages) / PAGES_PER_MAPWORD;
     end_off   = (first_page + nr_pages) & (PAGES_PER_MAPWORD-1);
+
+    if (curr_idx < first_pg)
+        first_pg = curr_idx;
+
 
     if ( curr_idx == end_idx )
     {
@@ -217,7 +229,7 @@ unsigned long alloc_boot_pages(unsigned 
 {
     unsigned long pg, i;
 
-    for ( pg = 0; (pg + nr_pfns) < max_page; pg += pfn_align )
+    for ( pg = first_pg; (pg + nr_pfns) < max_page; pg += pfn_align )
     {
         for ( i = 0; i < nr_pfns; i++ )
             if ( allocated_in_map(pg + i) )
_______________________________________________
Xen-ia64-devel mailing list
Xen-ia64-devel@xxxxxxxxxxxxxxxxxxx
http://lists.xensource.com/xen-ia64-devel

 


Rackspace

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