[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] [Xen-changelog] [xen-unstable] Nested p2m: use a linked list for LRU np2m selection.
# HG changeset patch # User Tim Deegan <Tim.Deegan@xxxxxxxxxx> # Date 1309426014 -3600 # Node ID 7db0edf339a5e8cb3aba3ba6d632504d96bdd32a # Parent 922e0beae95b436c1474b88847e13775a6053cf9 Nested p2m: use a linked list for LRU np2m selection. Because the flush-all-np2ms op doesn't take the np2m lock any more we can't reorder the p2ms in the array that it will walk. Signed-off-by: Tim Deegan <Tim.Deegan@xxxxxxxxxx> --- diff -r 922e0beae95b -r 7db0edf339a5 xen/arch/x86/mm/p2m.c --- a/xen/arch/x86/mm/p2m.c Thu Jun 30 10:26:54 2011 +0100 +++ b/xen/arch/x86/mm/p2m.c Thu Jun 30 10:26:54 2011 +0100 @@ -73,6 +73,7 @@ { memset(p2m, 0, sizeof(*p2m)); mm_lock_init(&p2m->lock); + INIT_LIST_HEAD(&p2m->np2m_list); INIT_PAGE_LIST_HEAD(&p2m->pages); INIT_PAGE_LIST_HEAD(&p2m->pod.super); INIT_PAGE_LIST_HEAD(&p2m->pod.single); @@ -104,6 +105,7 @@ return -ENOMEM; p2m_initialise(d, p2m); p2m->write_p2m_entry = nestedp2m_write_p2m_entry; + list_add(&p2m->np2m_list, &p2m_get_hostp2m(d)->np2m_list); } return 0; @@ -1048,37 +1050,16 @@ static struct p2m_domain * p2m_getlru_nestedp2m(struct domain *d, struct p2m_domain *p2m) { - int i, lru_index = -1; - struct p2m_domain *lrup2m, *tmp; + struct list_head *lru_list = &p2m_get_hostp2m(d)->np2m_list; + + ASSERT(!list_empty(lru_list)); - if (p2m == NULL) { - lru_index = MAX_NESTEDP2M - 1; - lrup2m = d->arch.nested_p2m[lru_index]; - } else { - lrup2m = p2m; - for (i = 0; i < MAX_NESTEDP2M; i++) { - if (d->arch.nested_p2m[i] == p2m) { - lru_index = i; - break; - } - } - } + if ( p2m == NULL ) + p2m = list_entry(lru_list->prev, struct p2m_domain, np2m_list); - ASSERT(lru_index >= 0); - if (lru_index == 0) { - return lrup2m; - } + list_move(&p2m->np2m_list, lru_list); - /* move the other's down the array "list" */ - for (i = lru_index - 1; i >= 0; i--) { - tmp = d->arch.nested_p2m[i]; - d->arch.nested_p2m[i+1] = tmp; - } - - /* make the entry the first one */ - d->arch.nested_p2m[0] = lrup2m; - - return lrup2m; + return p2m; } /* Reset this p2m table to be empty */ diff -r 922e0beae95b -r 7db0edf339a5 xen/include/asm-x86/p2m.h --- a/xen/include/asm-x86/p2m.h Thu Jun 30 10:26:54 2011 +0100 +++ b/xen/include/asm-x86/p2m.h Thu Jun 30 10:26:54 2011 +0100 @@ -209,6 +209,12 @@ #define CR3_EADDR (~0ULL) uint64_t cr3; + /* Nested p2ms: linked list of n2pms allocated to this domain. + * The host p2m hasolds the head of the list and the np2ms are + * threaded on in LRU order. */ + struct list_head np2m_list; + + /* Host p2m: when this flag is set, don't flush all the nested-p2m * tables on every host-p2m change. The setter of this flag * is responsible for performing the full flush before releasing the _______________________________________________ Xen-changelog mailing list Xen-changelog@xxxxxxxxxxxxxxxxxxx http://lists.xensource.com/xen-changelog
|
Lists.xenproject.org is hosted with RackSpace, monitoring our |