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] [XEN] Move mark_dirty() from alloc_page_t

To: xen-changelog@xxxxxxxxxxxxxxxxxxx
Subject: [Xen-changelog] [xen-unstable] [XEN] Move mark_dirty() from alloc_page_type() to get_page_type(),
From: Xen patchbot-unstable <patchbot-unstable@xxxxxxxxxxxxxxxxxxx>
Date: Wed, 20 Sep 2006 19:30:15 +0000
Delivery-date: Wed, 20 Sep 2006 12:31:21 -0700
Envelope-to: www-data@xxxxxxxxxxxxxxxxxx
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/cgi-bin/mailman/listinfo/xen-changelog>, <mailto:xen-changelog-request@lists.xensource.com?subject=subscribe>
List-unsubscribe: <http://lists.xensource.com/cgi-bin/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 kfraser@xxxxxxxxxxxxxxxxxxxxx
# Node ID affbab70fca28b6ab6bb483bc149543c21aa2617
# Parent  6d83c86ebfe913b23bdd1e59278e0b4f605047dd
[XEN] Move mark_dirty() from alloc_page_type() to get_page_type(),
for symmetry with put_page_type(). Limit calls to mark_dirty() in
put_page_type() so that they happen only for page-table pages.
Signed-off-by: Keir Fraser <keir@xxxxxxxxxxxxx>
---
 xen/arch/x86/mm.c |   38 +++++++++++++++-----------------------
 1 files changed, 15 insertions(+), 23 deletions(-)

diff -r 6d83c86ebfe9 -r affbab70fca2 xen/arch/x86/mm.c
--- a/xen/arch/x86/mm.c Wed Sep 20 18:33:26 2006 +0100
+++ b/xen/arch/x86/mm.c Wed Sep 20 18:41:44 2006 +0100
@@ -1490,26 +1490,19 @@ static int mod_l4_entry(l4_pgentry_t *pl
 
 int alloc_page_type(struct page_info *page, unsigned long type)
 {
-    int rc;
-
     switch ( type & PGT_type_mask )
     {
     case PGT_l1_page_table:
-        rc = alloc_l1_table(page);
-        break;
+        return alloc_l1_table(page);
     case PGT_l2_page_table:
-        rc = alloc_l2_table(page, type);
-        break;
+        return alloc_l2_table(page, type);
     case PGT_l3_page_table:
-        rc = alloc_l3_table(page);
-        break;
+        return alloc_l3_table(page);
     case PGT_l4_page_table:
-        rc = alloc_l4_table(page);
-        break;
+        return alloc_l4_table(page);
     case PGT_gdt_page:
     case PGT_ldt_page:
-        rc = alloc_segdesc_page(page);
-        break;
+        return alloc_segdesc_page(page);
     default:
         printk("Bad type in alloc_page_type %lx t=%" PRtype_info " c=%x\n", 
                type, page->u.inuse.type_info,
@@ -1517,15 +1510,7 @@ int alloc_page_type(struct page_info *pa
         BUG();
     }
 
-    /*
-     * A page is dirtied when its type count becomes non-zero.
-     * It is safe to mark dirty here because any PTE modifications in
-     * alloc_l?_table have now happened. The caller has already set the type
-     * and incremented the reference count.
-     */
-    mark_dirty(page_get_owner(page), page_to_mfn(page));
-
-    return rc;
+    return 0;
 }
 
 
@@ -1625,11 +1610,11 @@ void put_page_type(struct page_info *pag
     while ( unlikely((y = cmpxchg(&page->u.inuse.type_info, x, nx)) != x) );
 
     /*
-     * A page is dirtied when its type count becomes zero.
+     * A page table is dirtied when its type count becomes zero.
      * We cannot set the dirty flag earlier than this because we must wait
      * until the type count has been zeroed by the CMPXCHG above.
      */
-    if ( unlikely((nx & PGT_count_mask) == 0) )
+    if ( unlikely((nx & (PGT_validated|PGT_count_mask)) == 0) )
         mark_dirty(page_get_owner(page), page_to_mfn(page));
 }
 
@@ -1716,6 +1701,13 @@ int get_page_type(struct page_info *page
 
         /* Noone else is updating simultaneously. */
         __set_bit(_PGT_validated, &page->u.inuse.type_info);
+
+        /*
+         * A page table is dirtied when its type count becomes non-zero. It is
+         * safe to mark dirty here because any PTE modifications in
+         * alloc_page_type() have now happened.
+         */
+        mark_dirty(page_get_owner(page), page_to_mfn(page));
     }
 
     return 1;

_______________________________________________
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] [XEN] Move mark_dirty() from alloc_page_type() to get_page_type(),, Xen patchbot-unstable <=