All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH] 3/7 xen: Add basic NUMA support - Increase Reservation
@ 2005-12-16 23:07 Ryan Harper
  0 siblings, 0 replies; only message in thread
From: Ryan Harper @ 2005-12-16 23:07 UTC (permalink / raw)
  To: xen-devel; +Cc: Ryan Grimm

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@us.ibm.com


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

Signed-off-by: Ryan Harper <ryanh@us.ibm.com>
Signed-off-by: Ryan Grimm <grimm@us.ibm.com
---
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))

^ permalink raw reply	[flat|nested] only message in thread

only message in thread, other threads:[~2005-12-16 23:07 UTC | newest]

Thread overview: (only message) (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2005-12-16 23:07 [PATCH] 3/7 xen: Add basic NUMA support - Increase Reservation Ryan Harper

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.