From mboxrd@z Thu Jan 1 00:00:00 1970 From: Andrew Jones Subject: Re: [PATCH] numa: select nodes by cpu affinity Date: Wed, 04 Aug 2010 18:01:56 +0200 Message-ID: <4C598EF4.50001@redhat.com> References: Mime-Version: 1.0 Content-Type: multipart/mixed; boundary="------------080909040708080201020101" Return-path: In-Reply-To: List-Unsubscribe: , List-Post: List-Help: List-Subscribe: , Sender: xen-devel-bounces@lists.xensource.com Errors-To: xen-devel-bounces@lists.xensource.com To: Keir Fraser Cc: "xen-devel@lists.xensource.com" , "dulloor@gmail.com" List-Id: xen-devel@lists.xenproject.org This is a multi-part message in MIME format. --------------080909040708080201020101 Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: 7bit On 08/04/2010 04:38 PM, Keir Fraser wrote: > Changeset 21913 in http://xenbits.xen.org/staging/xen-unstable.hg > > -- Keir > > On 04/08/2010 13:38, "Keir Fraser" wrote: > >> Good idea. I will take this and rework it a bit and check it in. >> >> Thanks, >> Keir >> >> On 04/08/2010 13:04, "Andrew Jones" wrote: > I also considered managing the nodemask as new domain state, as you do, as it may come in useful elsewhere, but my principle of least patch instincts kept me from doing it... I'm not sure about keeping track of the last_alloc_node and then always avoiding it (at least when there's more than 1 node) by checking it last. I liked the way it worked before, favoring the node of the currently running processor, but I don't have any perf numbers to know what would be better. I've attached a patch with a couple minor tweaks. It removes the unnecessary node clearing from an empty initialized nodemask, and also moves a couple of domain_update_node_affinity() calls outside for_each_vcpu loops. Andrew --------------080909040708080201020101 Content-Type: text/plain; name="nodemask-tweak.diff" Content-Transfer-Encoding: 7bit Content-Disposition: attachment; filename="nodemask-tweak.diff" diff --git a/xen/common/domain.c b/xen/common/domain.c --- a/xen/common/domain.c +++ b/xen/common/domain.c @@ -358,12 +358,8 @@ cpus_or(cpumask, cpumask, v->cpu_affinity); for_each_online_node ( node ) - { if ( cpus_intersects(node_to_cpumask(node), cpumask) ) node_set(node, nodemask); - else - node_clear(node, nodemask); - } d->node_affinity = nodemask; spin_unlock(&d->node_affinity_lock); diff --git a/xen/common/schedule.c b/xen/common/schedule.c --- a/xen/common/schedule.c +++ b/xen/common/schedule.c @@ -270,13 +270,13 @@ SCHED_OP(VCPU2OP(v), destroy_vcpu, v); cpus_setall(v->cpu_affinity); - domain_update_node_affinity(d); v->processor = new_p; v->sched_priv = vcpu_priv[v->vcpu_id]; evtchn_move_pirqs(v); new_p = cycle_cpu(new_p, c->cpu_valid); } + domain_update_node_affinity(d); d->cpupool = c; SCHED_OP(DOM2OP(d), free_domdata, d->sched_priv); @@ -478,7 +478,6 @@ printk("Breaking vcpu affinity for domain %d vcpu %d\n", v->domain->domain_id, v->vcpu_id); cpus_setall(v->cpu_affinity); - domain_update_node_affinity(d); } if ( v->processor == cpu ) @@ -501,6 +500,7 @@ if ( v->processor == cpu ) ret = -EAGAIN; } + domain_update_node_affinity(d); } return ret; } --------------080909040708080201020101 Content-Type: text/plain; charset="us-ascii" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit Content-Disposition: inline _______________________________________________ Xen-devel mailing list Xen-devel@lists.xensource.com http://lists.xensource.com/xen-devel --------------080909040708080201020101--