[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] [Xen-changelog] [xen-unstable] x86/mm: Fix paging stats
# HG changeset patch # User Andres Lagar-Cavilla <andres@xxxxxxxxxxxxxxxx> # Date 1328185354 0 # Node ID ac6c596e8439a070212c34379446204818c06884 # Parent 030db911083f44dce966709991eae0d3dd405bf5 x86/mm: Fix paging stats There are several corner cases in which a page is paged back in, not by paging, and the stats are not properly updated. Signed-off-by: Andres Lagar-Cavilla <andres@xxxxxxxxxxxxxxxx> Acked-by: Tim Deegan <tim@xxxxxxx> Committed-by: Tim Deegan <tim@xxxxxxx> --- diff -r 030db911083f -r ac6c596e8439 xen/arch/x86/mm/mem_sharing.c --- a/xen/arch/x86/mm/mem_sharing.c Thu Feb 02 12:22:34 2012 +0000 +++ b/xen/arch/x86/mm/mem_sharing.c Thu Feb 02 12:22:34 2012 +0000 @@ -878,8 +878,12 @@ ret = -ENOENT; mem_sharing_gfn_destroy(cd, gfn_info); put_page_and_type(spage); - } else + } else { 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); + } atomic_inc(&nr_saved_mfns); diff -r 030db911083f -r ac6c596e8439 xen/arch/x86/mm/p2m.c --- a/xen/arch/x86/mm/p2m.c Thu Feb 02 12:22:34 2012 +0000 +++ b/xen/arch/x86/mm/p2m.c Thu Feb 02 12:22:34 2012 +0000 @@ -499,6 +499,11 @@ /* Count how man PoD entries we'll be replacing if successful */ pod_count++; } + else if ( p2m_is_paging(ot) && (ot != p2m_ram_paging_out) ) + { + /* We're plugging a hole in the physmap where a paged out page was */ + atomic_dec(&d->paged_pages); + } } /* Then, look for m->p mappings for this range and deal with them */ @@ -856,7 +861,8 @@ * released by the guest. The pager is supposed to drop its reference of the * gfn. */ -void p2m_mem_paging_drop_page(struct domain *d, unsigned long gfn) +void p2m_mem_paging_drop_page(struct domain *d, unsigned long gfn, + p2m_type_t p2mt) { mem_event_request_t req; @@ -875,6 +881,10 @@ req.flags = MEM_EVENT_FLAG_DROP_PAGE; mem_event_put_request(d, &d->mem_event->paging, &req); + + /* Update stats unless the page hasn't yet been evicted */ + if ( p2mt != p2m_ram_paging_out ) + atomic_dec(&d->paged_pages); } /** diff -r 030db911083f -r ac6c596e8439 xen/common/memory.c --- a/xen/common/memory.c Thu Feb 02 12:22:34 2012 +0000 +++ b/xen/common/memory.c Thu Feb 02 12:22:34 2012 +0000 @@ -166,7 +166,7 @@ if ( unlikely(p2m_is_paging(p2mt)) ) { guest_physmap_remove_page(d, gmfn, mfn, 0); - p2m_mem_paging_drop_page(d, gmfn); + p2m_mem_paging_drop_page(d, gmfn, p2mt); put_gfn(d, gmfn); return 1; } diff -r 030db911083f -r ac6c596e8439 xen/include/asm-x86/p2m.h --- a/xen/include/asm-x86/p2m.h Thu Feb 02 12:22:34 2012 +0000 +++ b/xen/include/asm-x86/p2m.h Thu Feb 02 12:22:34 2012 +0000 @@ -475,7 +475,8 @@ /* Evict a frame */ int p2m_mem_paging_evict(struct domain *d, unsigned long gfn); /* Tell xenpaging to drop a paged out frame */ -void p2m_mem_paging_drop_page(struct domain *d, unsigned long gfn); +void p2m_mem_paging_drop_page(struct domain *d, unsigned long gfn, + p2m_type_t p2mt); /* Start populating a paged out frame */ void p2m_mem_paging_populate(struct domain *d, unsigned long gfn); /* Prepare the p2m for paging a frame in */ @@ -483,7 +484,8 @@ /* Resume normal operation (in case a domain was paused) */ void p2m_mem_paging_resume(struct domain *d); #else -static inline void p2m_mem_paging_drop_page(struct domain *d, unsigned long gfn) +static inline void p2m_mem_paging_drop_page(struct domain *d, unsigned long gfn, + p2m_type_t p2mt) { } static inline void p2m_mem_paging_populate(struct domain *d, unsigned long gfn) { } _______________________________________________ Xen-changelog mailing list Xen-changelog@xxxxxxxxxxxxxxxxxxx http://lists.xensource.com/xen-changelog
|
Lists.xenproject.org is hosted with RackSpace, monitoring our |