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

[Xen-changelog] [xen-unstable] x86/mem_sharing: Allow paging-in pages to be replaced by shared ones.


  • To: xen-changelog@xxxxxxxxxxxxxxxxxxx
  • From: Xen patchbot-unstable <patchbot@xxxxxxx>
  • Date: Sat, 19 May 2012 14:22:08 +0000
  • Delivery-date: Sat, 19 May 2012 14:22:20 +0000
  • List-id: "Change log for Mercurial \(receive only\)" <xen-changelog.lists.xen.org>

# HG changeset patch
# User Andres Lagar-Cavilla <andres@xxxxxxxxxxxxxxxx>
# Date 1337354361 -3600
# Node ID 592d15bd4d5ec58486d32ee9998319e7c95fcd66
# Parent  745b9920dfa39ac7e569f86591835d0984fa4b88
x86/mem_sharing: Allow paging-in pages to be replaced by shared ones.

Making sure to tidy up any partially paged frames.

Signed-off-by: Andres Lagar-Cavilla <andres@xxxxxxxxxxxxxxxx>
Acked-by: Tim Deegan <tim@xxxxxxx>
Committed-by: Tim Deegan <tim@xxxxxxx>
---


diff -r 745b9920dfa3 -r 592d15bd4d5e xen/arch/x86/mm/mem_sharing.c
--- a/xen/arch/x86/mm/mem_sharing.c     Fri May 18 13:40:00 2012 +0100
+++ b/xen/arch/x86/mm/mem_sharing.c     Fri May 18 16:19:21 2012 +0100
@@ -1103,7 +1103,17 @@ int mem_sharing_add_to_physmap(struct do
         ret = 0;
         /* There is a chance we're plugging a hole where a paged out page was 
*/
         if ( p2m_is_paging(cmfn_type) && (cmfn_type != p2m_ram_paging_out) )
+        {
             atomic_dec(&cd->paged_pages);
+            /* Further, there is a chance this was a valid page. Don't leak 
it. */
+            if ( mfn_valid(cmfn) )
+            {
+                struct page_info *cpage = mfn_to_page(cmfn);
+                ASSERT(cpage != NULL);
+                if ( test_and_clear_bit(_PGC_allocated, &cpage->count_info) )
+                    put_page(cpage);
+            }
+        }
     }
 
     atomic_inc(&nr_saved_mfns);
diff -r 745b9920dfa3 -r 592d15bd4d5e xen/include/asm-x86/p2m.h
--- a/xen/include/asm-x86/p2m.h Fri May 18 13:40:00 2012 +0100
+++ b/xen/include/asm-x86/p2m.h Fri May 18 16:19:21 2012 +0100
@@ -137,6 +137,7 @@ typedef unsigned int p2m_query_t;
  * entry */
 #define P2M_HOLE_TYPES (p2m_to_mask(p2m_mmio_dm)        \
                        | p2m_to_mask(p2m_invalid)       \
+                       | p2m_to_mask(p2m_ram_paging_in) \
                        | p2m_to_mask(p2m_ram_paged))
 
 /* Grant mapping types, which map to a real machine frame in another

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