All of lore.kernel.org
 help / color / mirror / Atom feed
From: Ryan Harper <ryanh@us.ibm.com>
To: xen-devel@lists.xensource.com
Cc: Ryan Grimm <grimm@us.ibm.com>
Subject: [PATCH] 3/7 xen: Add basic NUMA support - Increase Reservation
Date: Fri, 16 Dec 2005 17:07:06 -0600	[thread overview]
Message-ID: <20051216230706.GA18911@us.ibm.com> (raw)

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))

                 reply	other threads:[~2005-12-16 23:07 UTC|newest]

Thread overview: [no followups] expand[flat|nested]  mbox.gz  Atom feed

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20051216230706.GA18911@us.ibm.com \
    --to=ryanh@us.ibm.com \
    --cc=grimm@us.ibm.com \
    --cc=xen-devel@lists.xensource.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
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.