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

[Xen-changelog] [xen-unstable] Add a page_info flag to indicate whether free pages need a TLB flush



# HG changeset patch
# User Keir Fraser <keir.fraser@xxxxxxxxxx>
# Date 1233835750 0
# Node ID 416197f0292b62425beb8277e122c41c645d9ab6
# Parent  3fc7d4115d6cd0ebf0cf55ed340da8a1b4c16592
Add a page_info flag to indicate whether free pages need a TLB flush
on next use.

Apart from teh small performance gain of this, my primary motivation
is to avoid TLB flushes very early in boot, when the system is not yet
properly set up for cross-TLB shootdowns.

Signed-off-by: Keir Fraser <keir.fraser@xxxxxxxxxx>
---
 xen/common/page_alloc.c   |   16 ++++++++++------
 xen/include/asm-ia64/mm.h |    2 ++
 xen/include/asm-x86/mm.h  |    6 ++++++
 3 files changed, 18 insertions(+), 6 deletions(-)

diff -r 3fc7d4115d6c -r 416197f0292b xen/common/page_alloc.c
--- a/xen/common/page_alloc.c   Thu Feb 05 08:28:00 2009 +0000
+++ b/xen/common/page_alloc.c   Thu Feb 05 12:09:10 2009 +0000
@@ -399,10 +399,13 @@ static struct page_info *alloc_heap_page
         /* Reference count must continuously be zero for free pages. */
         BUG_ON(pg[i].count_info != 0);
 
-        /* Add in any extra CPUs that need flushing because of this page. */
-        cpus_andnot(extra_cpus_mask, cpu_online_map, mask);
-        tlbflush_filter(extra_cpus_mask, pg[i].tlbflush_timestamp);
-        cpus_or(mask, mask, extra_cpus_mask);
+        if ( pg[i].u.free.need_tlbflush )
+        {
+            /* Add in extra CPUs that need flushing because of this page. */
+            cpus_andnot(extra_cpus_mask, cpu_online_map, mask);
+            tlbflush_filter(extra_cpus_mask, pg[i].tlbflush_timestamp);
+            cpus_or(mask, mask, extra_cpus_mask);
+        }
 
         /* Initialise fields which have other uses for free pages. */
         pg[i].u.inuse.type_info = 0;
@@ -446,8 +449,9 @@ static void free_heap_pages(
         pg[i].count_info = 0;
 
         /* If a page has no owner it will need no safety TLB flush. */
-        pg[i].tlbflush_timestamp =
-            page_get_owner(&pg[i]) ? tlbflush_current_time() : 0;
+        pg[i].u.free.need_tlbflush = (page_get_owner(&pg[i]) != NULL);
+        if ( pg[i].u.free.need_tlbflush )
+            pg[i].tlbflush_timestamp = tlbflush_current_time();
     }
 
     spin_lock(&heap_lock);
diff -r 3fc7d4115d6c -r 416197f0292b xen/include/asm-ia64/mm.h
--- a/xen/include/asm-ia64/mm.h Thu Feb 05 08:28:00 2009 +0000
+++ b/xen/include/asm-ia64/mm.h Thu Feb 05 12:09:10 2009 +0000
@@ -62,6 +62,8 @@ struct page_info
         struct {
             /* Order-size of the free chunk this page is the head of. */
             u32 order;
+            /* Do TLBs need flushing for safety before next page use? */
+            bool_t need_tlbflush;
         } free;
 
     } u;
diff -r 3fc7d4115d6c -r 416197f0292b xen/include/asm-x86/mm.h
--- a/xen/include/asm-x86/mm.h  Thu Feb 05 08:28:00 2009 +0000
+++ b/xen/include/asm-x86/mm.h  Thu Feb 05 12:09:10 2009 +0000
@@ -65,6 +65,12 @@ struct page_info
             unsigned long pinned:1; /* Is the shadow pinned? */
             unsigned long count:26; /* Reference count */
         } sh;
+
+        /* Page is on a free list: ((count_info & PGC_count_mask) == 0). */
+        struct {
+            /* Do TLBs need flushing for safety before next page use? */
+            bool_t need_tlbflush;
+        } free;
 
     } u;
 

_______________________________________________
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®.