Making sure to tidy up any partially paged frames.
Signed-off-by: Andres Lagar-Cavilla <andres@lagarcavilla.org>
Acked-by: Tim Deegan <tim@xen.org>
Committed-by: Tim Deegan <tim@xen.org>
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);
* 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