WARNING - OLD ARCHIVES

This is an archived copy of the Xen.org mailing list, which we have preserved to ensure that existing links to archives are not broken. The live archive, which contains the latest emails, can be found at http://lists.xen.org/
   
 
 
Xen 
 
Home Products Support Community News
 
   
 

xen-changelog

[Xen-changelog] [xen-unstable] page scrub: Serialise softirq with a new

To: xen-changelog@xxxxxxxxxxxxxxxxxxx
Subject: [Xen-changelog] [xen-unstable] page scrub: Serialise softirq with a new lock.
From: Xen patchbot-unstable <patchbot-unstable@xxxxxxxxxxxxxxxxxxx>
Date: Mon, 11 Aug 2008 05:50:57 -0700
Delivery-date: Mon, 11 Aug 2008 05:53:58 -0700
Envelope-to: www-data@xxxxxxxxxxxxxxxxxxx
List-help: <mailto:xen-changelog-request@lists.xensource.com?subject=help>
List-id: BK change log <xen-changelog.lists.xensource.com>
List-post: <mailto:xen-changelog@lists.xensource.com>
List-subscribe: <http://lists.xensource.com/mailman/listinfo/xen-changelog>, <mailto:xen-changelog-request@lists.xensource.com?subject=subscribe>
List-unsubscribe: <http://lists.xensource.com/mailman/listinfo/xen-changelog>, <mailto:xen-changelog-request@lists.xensource.com?subject=unsubscribe>
Reply-to: xen-devel@xxxxxxxxxxxxxxxxxxx
Sender: xen-changelog-bounces@xxxxxxxxxxxxxxxxxxx
# HG changeset patch
# User Keir Fraser <keir.fraser@xxxxxxxxxx>
# Date 1218453611 -3600
# Node ID 32aa43364f5d8e19389d1f72d9b0bf51e198152f
# Parent  ce085fc0d2e423aa1c602ce117cc775b000470ba
page scrub: Serialise softirq with a new lock.
Avoids holding up acquiring page_scrub_lock in free_domheap_pages().

Signed-off-by: Keir Fraser <keir.fraser@xxxxxxxxxx>
---
 xen/common/page_alloc.c |   14 ++++++++++----
 1 files changed, 10 insertions(+), 4 deletions(-)

diff -r ce085fc0d2e4 -r 32aa43364f5d xen/common/page_alloc.c
--- a/xen/common/page_alloc.c   Mon Aug 11 11:27:40 2008 +0100
+++ b/xen/common/page_alloc.c   Mon Aug 11 12:20:11 2008 +0100
@@ -950,9 +950,10 @@ static void page_scrub_softirq(void)
     void             *p;
     int               i;
     s_time_t          start = NOW();
+    static spinlock_t serialise_lock = SPIN_LOCK_UNLOCKED;
 
     /* free_heap_pages() does not parallelise well. Serialise this function. */
-    if ( !spin_trylock(&page_scrub_lock) )
+    if ( !spin_trylock(&serialise_lock) )
     {
         set_timer(&this_cpu(page_scrub_timer), NOW() + MILLISECS(1));
         return;
@@ -960,10 +961,12 @@ static void page_scrub_softirq(void)
 
     /* 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);
-            return;
+            goto out;
         }
         
         /* Peel up to 16 pages from the list. */
@@ -978,6 +981,8 @@ 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 )
@@ -991,9 +996,10 @@ static void page_scrub_softirq(void)
         }
     } while ( (NOW() - start) < MILLISECS(1) );
 
-    spin_unlock(&page_scrub_lock);
-
     set_timer(&this_cpu(page_scrub_timer), NOW() + MILLISECS(10));
+
+ out:
+    spin_unlock(&serialise_lock);
 }
 
 static void page_scrub_timer_fn(void *unused)

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

<Prev in Thread] Current Thread [Next in Thread>
  • [Xen-changelog] [xen-unstable] page scrub: Serialise softirq with a new lock., Xen patchbot-unstable <=