| [Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
 Re: [Xen-devel] [PATCH 03 of 11 v3] xen: sched_credit: when picking, make sure we get an idle one, if any
 
To: Dario Faggioli <dario.faggioli@xxxxxxxxxx>From: Juergen Gross <juergen.gross@xxxxxxxxxxxxxx>Date: Fri, 01 Feb 2013 14:57:11 +0100Cc: Marcus Granado <Marcus.Granado@xxxxxxxxxxxxx>,	Dan Magenheimer <dan.magenheimer@xxxxxxxxxx>,	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: Fri, 01 Feb 2013 13:57:38 +0000Domainkey-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=m+yvpdcO8up/Xbis+HnX1r+S4Gc28NfEEzpNCbQgNS8S+YGIL7Nueqf+	2hQG70C1vGNwAKlOcD7m+/XPqgRJV4CWJfpb6qv6NMADhWX5bp3e5Z8mo	Zf5z53dNd5E+4YyR9feOFsHW9YoDB16J1ZFrJah530baiW6OH5qAgoSLC	O4xv/t0u2qs9c18117yhBx7zs4HBEQi0N7/4U8B8J7N9uTMwUgW6Fi3lN	x9fCRsPWz/eo56+/2/1QczeUvQnvm;List-id: Xen developer discussion <xen-devel.lists.xen.org> 
 
Am 01.02.2013 12:01, schrieb Dario Faggioli:
 
The pcpu picking algorithm treats two threads of a SMT core the same.
More specifically, if one is idle and the other one is busy, they both
will be assigned a weight of 1. Therefore, when picking begins, if the
first target pcpu is the busy thread (and if there are no other idle
pcpu than its sibling), that will never change.
This change fixes this by ensuring that, before entering the core of
the picking algorithm, the target pcpu is an idle one (if there is an
idle pcpu at all, of course).
Signed-off-by: Dario Faggioli<dario.faggioli@xxxxxxxxxx>
 
Acked-by: Juergen Gross <juergen.gross@xxxxxxxxxxxxxx>
 
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
@@ -526,6 +526,18 @@ static int
      if ( vc->processor == cpu&&  IS_RUNQ_IDLE(cpu) )
          cpumask_set_cpu(cpu,&idlers);
      cpumask_and(&cpus,&cpus,&idlers);
+
+    /*
+     * It is important that cpu points to an idle processor, if a suitable
+     * one exists (and we can use cpus to check and, possibly, choose a new
+     * CPU, as we just&&-ed it with idlers). In fact, if we are on SMT, and
+     * cpu points to a busy thread with an idle sibling, both the threads
+     * will be considered the same, from the "idleness" calculation point
+     * of view", preventing vcpu from being moved to the thread that is
+     * actually idle.
+     */
+    if ( !cpumask_empty(&cpus)&&  !cpumask_test_cpu(cpu,&cpus) )
+        cpu = cpumask_cycle(cpu,&cpus);
      cpumask_clear_cpu(cpu,&cpus);
      while ( !cpumask_empty(&cpus) )
_______________________________________________
Xen-devel mailing list
Xen-devel@xxxxxxxxxxxxx
http://lists.xen.org/xen-devel
 
--
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
 
 |