xen-devel.lists.xenproject.org archive mirror
 help / color / mirror / Atom feed
From: Juergen Gross <juergen.gross@ts.fujitsu.com>
To: xen-devel@lists.xensource.com
Subject: [PATCH 2 of 3] switch to dynamically allocated cpumask in	domain_update_node_affinity()
Date: Tue, 24 Jan 2012 11:06:08 +0100	[thread overview]
Message-ID: <0caec9849a8c98bc3afa.1327399568@nehalem1> (raw)
In-Reply-To: <patchbomb.1327399566@nehalem1>

[-- Attachment #1: Type: text/plain, Size: 187 bytes --]

cpumasks should rather be allocated dynamically.

Signed-off-by: juergen.gross@ts.fujitsu.com


1 file changed, 9 insertions(+), 4 deletions(-)
xen/common/domain.c |   13 +++++++++----



[-- Attachment #2: xen-staging.hg-3.patch --]
[-- Type: text/x-patch, Size: 1647 bytes --]

# HG changeset patch
# User Juergen Gross <juergen.gross@ts.fujitsu.com>
# Date 1327399530 -3600
# Node ID 0caec9849a8c98bc3afa650199683c6f294bf101
# Parent  5589314aa984152c684bedffb4276272646314f0
switch to dynamically allocated cpumask in domain_update_node_affinity()

cpumasks should rather be allocated dynamically.

Signed-off-by: juergen.gross@ts.fujitsu.com

diff -r 5589314aa984 -r 0caec9849a8c xen/common/domain.c
--- a/xen/common/domain.c	Tue Jan 24 11:03:03 2012 +0100
+++ b/xen/common/domain.c	Tue Jan 24 11:05:30 2012 +0100
@@ -220,6 +220,7 @@ struct domain *domain_create(
     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 @@ struct domain *domain_create(
 
 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);
 }
 
 

[-- Attachment #3: Type: text/plain, Size: 138 bytes --]

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

  parent reply	other threads:[~2012-01-24 10:06 UTC|newest]

Thread overview: 8+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2012-01-24 10:06 [PATCH 0 of 3] Reflect cpupool in numa node affinity (v5) Juergen Gross
2012-01-24 10:06 ` [PATCH 1 of 3] introduce and use common macros for selecting cpupool based cpumasks Juergen Gross
2012-01-24 10:06 ` Juergen Gross [this message]
2012-01-24 10:06 ` [PATCH 3 of 3] reflect cpupool in numa node affinity Juergen Gross
  -- strict thread matches above, loose matches on Subject: below --
2012-01-24  5:54 [PATCH 0 of 3] Reflect cpupool in numa node affinity (v4) Juergen Gross
2012-01-24  5:54 ` [PATCH 2 of 3] switch to dynamically allocated cpumask in domain_update_node_affinity() Juergen Gross
2012-01-24  9:33   ` Ian Campbell
2012-01-24  9:56     ` Juergen Gross
2012-01-24 10:04       ` Ian Campbell

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=0caec9849a8c98bc3afa.1327399568@nehalem1 \
    --to=juergen.gross@ts.fujitsu.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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).