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

[Xen-changelog] [xen-unstable] switch to dynamically allocated cpumask in domain_update_node_affinity()



# HG changeset patch
# User Juergen Gross <juergen.gross@xxxxxxxxxxxxxx>
# Date 1327414840 0
# Node ID 455a50622fb2a135e6bbfce8705fddc8705fe2d7
# Parent  3df3a0a95551a65ae0c29a481f0f756b63a3f37c
switch to dynamically allocated cpumask in domain_update_node_affinity()

cpumasks should rather be allocated dynamically.

Signed-off-by: juergen.gross@xxxxxxxxxxxxxx
Committed-by: Keir Fraser <keir@xxxxxxx>
---


diff -r 3df3a0a95551 -r 455a50622fb2 xen/common/domain.c
--- a/xen/common/domain.c       Tue Jan 24 14:19:58 2012 +0000
+++ b/xen/common/domain.c       Tue Jan 24 14:20:40 2012 +0000
@@ -220,6 +220,7 @@
     INIT_PAGE_LIST_HEAD(&d->xenpage_list);
 
     spin_lock_init(&d->node_affinity_lock);
+    d->node_affinity = NODE_MASK_ALL;
 
     spin_lock_init(&d->shutdown_lock);
     d->shutdown_code = -1;
@@ -333,23 +334,27 @@
 
 void domain_update_node_affinity(struct domain *d)
 {
-    cpumask_t cpumask;
+    cpumask_var_t cpumask;
     nodemask_t nodemask = NODE_MASK_NONE;
     struct vcpu *v;
     unsigned int node;
 
-    cpumask_clear(&cpumask);
+    if ( !zalloc_cpumask_var(&cpumask) )
+        return;
+
     spin_lock(&d->node_affinity_lock);
 
     for_each_vcpu ( d, v )
-        cpumask_or(&cpumask, &cpumask, v->cpu_affinity);
+        cpumask_or(cpumask, cpumask, v->cpu_affinity);
 
     for_each_online_node ( node )
-        if ( cpumask_intersects(&node_to_cpumask(node), &cpumask) )
+        if ( cpumask_intersects(&node_to_cpumask(node), cpumask) )
             node_set(node, nodemask);
 
     d->node_affinity = nodemask;
     spin_unlock(&d->node_affinity_lock);
+
+    free_cpumask_var(cpumask);
 }
 
 

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


 


Rackspace

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