static inline void put_page_alloc_ref(struct page_info *page)
{
/*
- * Whenever a page is assigned to a domain then the _PGC_allocated bit
- * is set and the reference count is set to at least 1. This function
- * clears that 'allocation reference' but it is unsafe to do so without
- * the caller holding an additional reference. I.e. the allocation
- * reference must never be the last reference held.
+ * Whenever a page is assigned to a domain then the _PGC_allocated
+ * bit is set and the reference count is set to at least 1. This
+ * function clears that 'allocation reference' but it is unsafe to
+ * do so to domheap pages without the caller holding an additional
+ * reference. I.e. the allocation reference must never be the last
+ * reference held.
+ *
+ * (It's safe for xenheap pages, because put_page() will not cause
+ * them to be freed.)
*/
if ( test_and_clear_bit(_PGC_allocated, &page->count_info) )
{
- BUG_ON((page->count_info & PGC_count_mask) <= 1);
+ BUG_ON((page->count_info & (PGC_xen_heap | PGC_count_mask)) <= 1);
put_page(page);
}
}