[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [Xen-devel] [PATCH 3 of 8] xen: let the (credit) scheduler know about `node affinity`
- To: Dario Faggioli <dario.faggioli@xxxxxxxxxx>
- From: Juergen Gross <juergen.gross@xxxxxxxxxxxxxx>
- Date: Tue, 09 Oct 2012 11:53:53 +0200
- Cc: Marcus Granado <Marcus.Granado@xxxxxxxxxxxxx>, Andre Przywara <andre.przywara@xxxxxxx>, Ian Campbell <Ian.Campbell@xxxxxxxxxx>, Anil Madhavapeddy <anil@xxxxxxxxxx>, George Dunlap <george.dunlap@xxxxxxxxxxxxx>, Andrew Cooper <Andrew.Cooper3@xxxxxxxxxx>, Ian Jackson <Ian.Jackson@xxxxxxxxxxxxx>, xen-devel@xxxxxxxxxxxxx, Jan Beulich <JBeulich@xxxxxxxx>, Daniel De Graaf <dgdegra@xxxxxxxxxxxxx>, Matt Wilson <msw@xxxxxxxxxx>
- Delivery-date: Tue, 09 Oct 2012 09:54:10 +0000
- Domainkey-signature: s=s1536a; d=ts.fujitsu.com; c=nofws; q=dns; h=X-SBRSScore:X-IronPort-AV:Received:X-IronPort-AV: Received:Received:Message-ID:Date:From:Organization: User-Agent:MIME-Version:To:CC:Subject:References: In-Reply-To:Content-Type:Content-Transfer-Encoding; b=eUlCHhFM+ATt1m0c89vLVGRRO/fqrc+3QqfGnIej2LczY5BPSoksk8ki qDsbGlS1MU4e9U8tLgTFwQu/h20MXMBj/ZsL4LKyE6qW0Z2/su/t2jv3h MxOPEW5EIcfYPXQ8k1LgW4cQkVIgTI+UfwYC1lCYbk9wYJL6C16Ys79d6 mvwZklZPRVrsUMSoKYEekBZuThqafJWmb6V+5imeQiHZeYvFreuZQVTmR XjtSYe1cY0wfqktZRKMur1bQ2d7I0;
- List-id: Xen developer discussion <xen-devel.lists.xen.org>
Am 05.10.2012 16:08, schrieb Dario Faggioli:
As vcpu-affinity tells where vcpus can run, node-affinity tells
where a domain's vcpus prefer to run. Respecting vcpu-affinity is
the primary concern, but honouring node-affinity will likely
result in some performances benefit.
This change modifies the vcpu load balancing algorithm (for the
credit scheduler only), introducing a two steps logic.
During the first step, we use the node-affinity mask. The aim is
giving precedence to the CPUs where it is known to be preferrable
for the domain to run. If that fails in finding a valid CPU, the
node-affinity is just ignored and, in the second step, we fall
back to using cpu-affinity only.
Signed-off-by: Dario Faggioli<dario.faggioli@xxxxxxxxxx>
diff --git a/xen/common/sched_credit.c b/xen/common/sched_credit.c
--- a/xen/common/sched_credit.c
+++ b/xen/common/sched_credit.c
...
static int
_csched_cpu_pick(const struct scheduler *ops, struct vcpu *vc, bool_t commit)
{
- cpumask_t cpus;
+ cpumask_t cpus, start_cpus;
cpumask_t idlers;
cpumask_t *online;
+ struct csched_dom *sdom = CSCHED_DOM(vc->domain);
struct csched_pcpu *spc = NULL;
int cpu;
/*
- * Pick from online CPUs in VCPU's affinity mask, giving a
- * preference to its current processor if it's in there.
+ * Pick an online CPU from the&& of vcpu-affinity and node-affinity
+ * masks (if not empty, in which case only the vcpu-affinity mask is
+ * used). Also, try to give a preference to its current processor if
+ * it's in there.
*/
online = cpupool_scheduler_cpumask(vc->domain->cpupool);
cpumask_and(&cpus, online, vc->cpu_affinity);
- cpu = cpumask_test_cpu(vc->processor,&cpus)
+ cpumask_and(&start_cpus,&cpus, sdom->node_affinity_cpumask);
+ if ( unlikely(cpumask_empty(&start_cpus)) )
+ cpumask_copy(&start_cpus,&cpus);
+ cpu = cpumask_test_cpu(vc->processor,&start_cpus)
? vc->processor
- : cpumask_cycle(vc->processor,&cpus);
+ : cpumask_cycle(vc->processor,&start_cpus);
ASSERT( !cpumask_empty(&cpus)&& cpumask_test_cpu(cpu,&cpus) );
Shouldn't the ASSERT be changed to start_cpus, too?
Juergen
--
Juergen Gross Principal Developer Operating Systems
PBG PDG ES&S SWE OS6 Telephone: +49 (0) 89 3222 2967
Fujitsu Technology Solutions e-mail: juergen.gross@xxxxxxxxxxxxxx
Domagkstr. 28 Internet: ts.fujitsu.com
D-80807 Muenchen Company details: ts.fujitsu.com/imprint.html
_______________________________________________
Xen-devel mailing list
Xen-devel@xxxxxxxxxxxxx
http://lists.xen.org/xen-devel
|