WARNING - OLD ARCHIVES

This is an archived copy of the Xen.org mailing list, which we have preserved to ensure that existing links to archives are not broken. The live archive, which contains the latest emails, can be found at http://lists.xen.org/
   
 
 
Xen 
 
Home Products Support Community News
 
   
 

xen-devel

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

To: xen-devel@xxxxxxxxxxxxxxxxxxx
Subject: [Xen-devel] [PATCH] 3/7 xen: Add basic NUMA support - Increase Reservation
From: Ryan Harper <ryanh@xxxxxxxxxx>
Date: Fri, 16 Dec 2005 17:07:06 -0600
Cc: Ryan Grimm <grimm@xxxxxxxxxx>
Delivery-date: Fri, 16 Dec 2005 23:09:16 +0000
Envelope-to: www-data@xxxxxxxxxxxxxxxxxxx
List-help: <mailto:xen-devel-request@lists.xensource.com?subject=help>
List-id: Xen developer discussion <xen-devel.lists.xensource.com>
List-post: <mailto:xen-devel@lists.xensource.com>
List-subscribe: <http://lists.xensource.com/cgi-bin/mailman/listinfo/xen-devel>, <mailto:xen-devel-request@lists.xensource.com?subject=subscribe>
List-unsubscribe: <http://lists.xensource.com/cgi-bin/mailman/listinfo/xen-devel>, <mailto:xen-devel-request@lists.xensource.com?subject=unsubscribe>
Sender: xen-devel-bounces@xxxxxxxxxxxxxxxxxxx
User-agent: Mutt/1.5.6+20040907i
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

<Prev in Thread] Current Thread [Next in Thread>
  • [Xen-devel] [PATCH] 3/7 xen: Add basic NUMA support - Increase Reservation, Ryan Harper <=