From mboxrd@z Thu Jan 1 00:00:00 1970 From: Ryan Harper Subject: [PATCH] 3/7 xen: Add basic NUMA support - Increase Reservation Date: Fri, 16 Dec 2005 17:07:06 -0600 Message-ID: <20051216230706.GA18911@us.ibm.com> Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Return-path: Content-Disposition: inline List-Unsubscribe: , List-Post: List-Help: List-Subscribe: , Sender: xen-devel-bounces@lists.xensource.com Errors-To: xen-devel-bounces@lists.xensource.com To: xen-devel@lists.xensource.com Cc: Ryan Grimm List-Id: xen-devel@lists.xenproject.org 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 Signed-off-by: Ryan Grimm 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))