[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Xen-devel] [RFC PATCH 2/2] xen: tmem: make tmem aware of NUMA affinity



Persistant pages in tmem are allocated by alloc_domheap_pages(domain) which
is consistent with that domain's node affinity. But that's not true for
ephemeral pages, because domain=NULL have to be passed to
alloc_domheap_pages(NULL).

This patch makes use of function alloc_domheap_pages_nodemask() introduced by
previous patch, so that we can still only allocate memory from nodes in
d->node_affinity even when domain=NULL.

Signed-off-by: Bob Liu <bob.liu@xxxxxxxxxx>
---
 xen/common/tmem.c          |    4 ++--
 xen/include/xen/tmem_xen.h |    4 ++--
 2 files changed, 4 insertions(+), 4 deletions(-)

diff --git a/xen/common/tmem.c b/xen/common/tmem.c
index 02e7e2e..0ca50b2 100644
--- a/xen/common/tmem.c
+++ b/xen/common/tmem.c
@@ -303,7 +303,7 @@ static struct page_info *tmem_alloc_page(struct tmem_pool 
*pool)
     if ( pool != NULL && is_persistent(pool) )
         pfp = __tmem_alloc_page_thispool(pool->client->domain);
     else
-        pfp = __tmem_alloc_page();
+        pfp = __tmem_alloc_page(pool->client->domain);
     if ( pfp == NULL )
         alloc_page_failed++;
     else
@@ -326,7 +326,7 @@ static noinline void *tmem_mempool_page_get(unsigned long 
size)
     struct page_info *pi;
 
     ASSERT(size == PAGE_SIZE);
-    if ( (pi = __tmem_alloc_page()) == NULL )
+    if ( (pi = __tmem_alloc_page(current->domain)) == NULL )
         return NULL;
     return page_to_virt(pi);
 }
diff --git a/xen/include/xen/tmem_xen.h b/xen/include/xen/tmem_xen.h
index 885ee21..be31aed 100644
--- a/xen/include/xen/tmem_xen.h
+++ b/xen/include/xen/tmem_xen.h
@@ -144,12 +144,12 @@ static inline void __tmem_free_page_thispool(struct 
page_info *pi)
 /*
  * Memory allocation for ephemeral (non-persistent) data
  */
-static inline struct page_info *__tmem_alloc_page(void)
+static inline struct page_info *__tmem_alloc_page(struct domain *d)
 {
     struct page_info *pi = tmem_page_list_get();
 
     if ( pi == NULL)
-        pi = alloc_domheap_pages(0,0,MEMF_tmem);
+        pi = alloc_domheap_pages_nodemask(0, 0, MEMF_tmem, d->node_affinity);
 
     if ( pi )
         atomic_inc(&freeable_page_count);
-- 
1.7.10.4


_______________________________________________
Xen-devel mailing list
Xen-devel@xxxxxxxxxxxxx
http://lists.xen.org/xen-devel


 


Rackspace

Lists.xenproject.org is hosted with RackSpace, monitoring our
servers 24x7x365 and backed by RackSpace's Fanatical Support®.