mirror of
https://github.com/xen-project/xen.git
synced 2026-10-29 10:40:03 +01:00
mm: keep PGC_extra pages on a separate list
This patch adds a new page_list_head into struct domain to hold PGC_extra pages. This avoids them getting confused with 'normal' domheap pages where the domain's page_list is walked. A new dump loop is also added to dump_pageframe_info() to unconditionally dump the 'extra page list'. Signed-off-by: Paul Durrant <paul@xen.org> Reviewed-by: Jan Beulich <jbeulich@suse.com> Acked-by: Julien Grall <julien@xen.org>
This commit is contained in:
1 parent
4c7d340f75
commit
4203f4d3df
6 files changed
+28
-8
No files matched your search
@@ -251,12 +251,21 @@ void dump_pageframe_info(struct domain *d)
|
||||
p2m_pod_dump_data(d);
|
||||
|
||||
spin_lock(&d->page_alloc_lock);
|
||||
|
||||
page_list_for_each ( page, &d->xenpage_list )
|
||||
{
|
||||
printk(" XenPage %p: caf=%08lx, taf=%" PRtype_info "\n",
|
||||
_p(mfn_x(page_to_mfn(page))),
|
||||
page->count_info, page->u.inuse.type_info);
|
||||
}
|
||||
|
||||
page_list_for_each ( page, &d->extra_page_list )
|
||||
{
|
||||
printk(" ExtraPage %p: caf=%08lx, taf=%" PRtype_info "\n",
|
||||
_p(mfn_x(page_to_mfn(page))),
|
||||
page->count_info, page->u.inuse.type_info);
|
||||
}
|
||||
|
||||
spin_unlock(&d->page_alloc_lock);
|
||||
}
|
||||
|
||||
|
||||
@@ -403,6 +403,7 @@ struct domain *domain_create(domid_t domid,
|
||||
spin_lock_init_prof(d, page_alloc_lock);
|
||||
spin_lock_init(&d->hypercall_deadlock_mutex);
|
||||
INIT_PAGE_LIST_HEAD(&d->page_list);
|
||||
INIT_PAGE_LIST_HEAD(&d->extra_page_list);
|
||||
INIT_PAGE_LIST_HEAD(&d->xenpage_list);
|
||||
|
||||
spin_lock_init(&d->node_affinity_lock);
|
||||
|
||||
@@ -2314,7 +2314,7 @@ int assign_pages(
|
||||
smp_wmb(); /* Domain pointer must be visible before updating refcnt. */
|
||||
pg[i].count_info =
|
||||
(pg[i].count_info & PGC_extra) | PGC_allocated | 1;
|
||||
page_list_add_tail(&pg[i], &d->page_list);
|
||||
page_list_add_tail(&pg[i], page_to_list(d, &pg[i]));
|
||||
}
|
||||
|
||||
out:
|
||||
|
||||
@@ -629,10 +629,8 @@ typedef struct mm_rwlock {
|
||||
const char *locker_function; /* func that took it */
|
||||
} mm_rwlock_t;
|
||||
|
||||
#define arch_free_heap_page(d, pg) \
|
||||
page_list_del2(pg, is_xen_heap_page(pg) ? \
|
||||
&(d)->xenpage_list : &(d)->page_list, \
|
||||
&(d)->arch.relmem_list)
|
||||
#define arch_free_heap_page(d, pg) \
|
||||
page_list_del2(pg, page_to_list(d, pg), &(d)->arch.relmem_list)
|
||||
|
||||
extern const char zero_page[];
|
||||
|
||||
|
||||
@@ -583,9 +583,8 @@ static inline unsigned int get_order_from_pages(unsigned long nr_pages)
|
||||
void scrub_one_page(struct page_info *);
|
||||
|
||||
#ifndef arch_free_heap_page
|
||||
#define arch_free_heap_page(d, pg) \
|
||||
page_list_del(pg, is_xen_heap_page(pg) ? \
|
||||
&(d)->xenpage_list : &(d)->page_list)
|
||||
#define arch_free_heap_page(d, pg) \
|
||||
page_list_del(pg, page_to_list(d, pg))
|
||||
#endif
|
||||
|
||||
int xenmem_add_to_physmap_one(struct domain *d, unsigned int space,
|
||||
|
||||
@@ -329,6 +329,7 @@ struct domain
|
||||
|
||||
spinlock_t page_alloc_lock; /* protects all the following fields */
|
||||
struct page_list_head page_list; /* linked list */
|
||||
struct page_list_head extra_page_list; /* linked list (size extra_pages) */
|
||||
struct page_list_head xenpage_list; /* linked list (size xenheap_pages) */
|
||||
|
||||
/*
|
||||
@@ -512,6 +513,18 @@ struct domain
|
||||
#endif
|
||||
};
|
||||
|
||||
static inline struct page_list_head *page_to_list(
|
||||
struct domain *d, const struct page_info *pg)
|
||||
{
|
||||
if ( is_xen_heap_page(pg) )
|
||||
return &d->xenpage_list;
|
||||
|
||||
if ( pg->count_info & PGC_extra )
|
||||
return &d->extra_page_list;
|
||||
|
||||
return &d->page_list;
|
||||
}
|
||||
|
||||
/* Return number of pages currently posessed by the domain */
|
||||
static inline unsigned int domain_tot_pages(const struct domain *d)
|
||||
{
|
||||
|
||||