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

[Xen-devel] [PATCH] 3/7 xen: Add basic NUMA support - Increase Reservation



This patch modifies the increase_reservation memory op to balance memory
across a domains' vcpus.  We index into the domain's vcpu array modulo
the max number of vcpus and pass the vcpu's processor to the domain page
allocator function.  

Note that this patch relies on the domain creating and migrating vcpus
prior to increasing a domain's reservation.  Xen and Xend already
exhibit the correct behavior due to early patches accepted in the tree.

-- 
Ryan Harper
Software Engineer; Linux Technology Center
IBM Corp., Austin, Tx
(512) 838-9253   T/L: 678-9253
ryanh@xxxxxxxxxx


diffstat output:
 common/memory.c  |   15 +++++++++++++++
 include/xen/mm.h |    4 ++++
 2 files changed, 19 insertions(+)

Signed-off-by: Ryan Harper <ryanh@xxxxxxxxxx>
Signed-off-by: Ryan Grimm <grimm@xxxxxxxxxx
---
diff -r df6e4f8b50de xen/common/memory.c
--- a/xen/common/memory.c       Tue Nov 15 18:33:29 2005
+++ b/xen/common/memory.c       Tue Nov 15 14:19:30 2005
@@ -31,6 +31,13 @@
     struct pfn_info *page;
     unsigned int     i;
 
+#ifdef CONFIG_NUMA
+    int max_vcpu_id = 0;
+    struct vcpu *v;
+
+    for_each_vcpu (d, v)
+        max_vcpu_id = v->vcpu_id;
+#endif
     if ( (extent_list != NULL) &&
          !array_access_ok(extent_list, nr_extents, sizeof(*extent_list)) )
         return 0;
@@ -49,8 +56,16 @@
             return i;
         }
 
+#ifdef CONFIG_NUMA
+        /* spread each allocation across the total number of 
+         * vcpus allocated to this domain */
+        if ( unlikely((page = __alloc_domheap_pages(
+            d, extent_order, flags, 
+            (d->vcpu[i % (max_vcpu_id+1)])->processor)) == NULL) ) 
+#else
         if ( unlikely((page = alloc_domheap_pages(
             d, extent_order, flags)) == NULL) )
+#endif
         {
             DPRINTK("Could not allocate order=%d extent: "
                     "id=%d flags=%x (%d of %d)\n",
diff -r df6e4f8b50de xen/include/xen/mm.h
--- a/xen/include/xen/mm.h      Tue Nov 15 18:33:29 2005
+++ b/xen/include/xen/mm.h      Tue Nov 15 14:19:30 2005
@@ -35,6 +35,10 @@
 void init_domheap_pages(physaddr_t ps, physaddr_t pe);
 struct pfn_info *alloc_domheap_pages(
     struct domain *d, unsigned int order, unsigned int flags);
+#ifdef CONFIG_NUMA
+struct pfn_info *__alloc_domheap_pages(
+    struct domain *d, unsigned int order, unsigned int flags, int cpu);
+#endif
 void free_domheap_pages(struct pfn_info *pg, unsigned int order);
 unsigned long avail_domheap_pages(void);
 #define alloc_domheap_page(d) (alloc_domheap_pages(d,0,0))

_______________________________________________
Xen-devel mailing list
Xen-devel@xxxxxxxxxxxxxxxxxxx
http://lists.xensource.com/xen-devel


 


Rackspace

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