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

[Xen-changelog] [xen-unstable] Serialize scrubbing pages



# HG changeset patch
# User Keir Fraser <keir.fraser@xxxxxxxxxx>
# Date 1218449930 -3600
# Node ID f10d436d9a9ef413135374e73b32659fc2da9cfb
# Parent  3d5515f40b9b2bfee339cc223f891bd5c61d6855
Serialize scrubbing pages

I noticed that parallel scrubbing pages is not efficient
due to spinlock contention. (also memory bandwidth?)
Actually heap_lock becomes a bottleneck.

In my investigation, it often takes 1 millisec just to acquire
the lock on ia64 with 8cpus. It's very wasteful.

Signed-off-by: Kouya Shimura <kouya@xxxxxxxxxxxxxx>
---
 xen/common/page_alloc.c |   13 +++++++++----
 1 files changed, 9 insertions(+), 4 deletions(-)

diff -r 3d5515f40b9b -r f10d436d9a9e xen/common/page_alloc.c
--- a/xen/common/page_alloc.c   Mon Aug 11 10:52:18 2008 +0100
+++ b/xen/common/page_alloc.c   Mon Aug 11 11:18:50 2008 +0100
@@ -951,10 +951,15 @@ static void page_scrub_softirq(void)
     int               i;
     s_time_t          start = NOW();
 
+    /* free_heap_pages() does not parallelise well. Serialise this function. */
+    if ( !spin_trylock(&page_scrub_lock) )
+    {
+        set_timer(&this_cpu(page_scrub_timer), NOW() + MILLISECS(1));
+        return;
+    }
+
     /* Aim to do 1ms of work every 10ms. */
     do {
-        spin_lock(&page_scrub_lock);
-
         if ( unlikely((ent = page_scrub_list.next) == &page_scrub_list) )
         {
             spin_unlock(&page_scrub_lock);
@@ -973,8 +978,6 @@ static void page_scrub_softirq(void)
         ent->next->prev = &page_scrub_list;
         page_scrub_list.next = ent->next;
         scrub_pages -= (i+1);
-
-        spin_unlock(&page_scrub_lock);
 
         /* Working backwards, scrub each page in turn. */
         while ( ent != &page_scrub_list )
@@ -987,6 +990,8 @@ static void page_scrub_softirq(void)
             free_heap_pages(pfn_dom_zone_type(page_to_mfn(pg)), pg, 0);
         }
     } while ( (NOW() - start) < MILLISECS(1) );
+
+    spin_unlock(&page_scrub_lock);
 
     set_timer(&this_cpu(page_scrub_timer), NOW() + MILLISECS(10));
 }

_______________________________________________
Xen-changelog mailing list
Xen-changelog@xxxxxxxxxxxxxxxxxxx
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®.