xen-devel.lists.xenproject.org archive mirror
 help / color / mirror / Atom feed
* [PATCH 3/3] _csched_cpu_pick(): simplify sched_smt_power_savings dependent condition
@ 2011-03-14 17:05 Jan Beulich
  0 siblings, 0 replies; only message in thread
From: Jan Beulich @ 2011-03-14 17:05 UTC (permalink / raw)
  To: xen-devel@lists.xensource.com

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

At least to me, using ?: instead of the (a && ...) || (!a && ...)
construct is far easier to grok with a single look.

Signed-off-by: Jan Beulich <jbeulich@novell.com>

--- a/xen/common/sched_credit.c
+++ b/xen/common/sched_credit.c
@@ -526,10 +526,9 @@ _csched_cpu_pick(const struct scheduler 
         weight_cpu = cpus_weight(cpu_idlers);
         weight_nxt = cpus_weight(nxt_idlers);
         /* smt_power_savings: consolidate work rather than spreading it */
-        if ( ( sched_smt_power_savings
-               && (weight_cpu > weight_nxt) )
-             || ( !sched_smt_power_savings
-                  && (weight_cpu * migrate_factor < weight_nxt) ) )
+        if ( sched_smt_power_savings ?
+             weight_cpu > weight_nxt :
+             weight_cpu * migrate_factor < weight_nxt )
         {
             cpus_and(nxt_idlers, cpus, nxt_idlers);
             spc = CSCHED_PCPU(nxt);




[-- Attachment #2: csched-pick-cleanup.patch --]
[-- Type: text/plain, Size: 924 bytes --]

At least to me, using ?: instead of the (a && ...) || (!a && ...)
construct is far easier to grok with a single look.

Signed-off-by: Jan Beulich <jbeulich@novell.com>

--- a/xen/common/sched_credit.c
+++ b/xen/common/sched_credit.c
@@ -526,10 +526,9 @@ _csched_cpu_pick(const struct scheduler 
         weight_cpu = cpus_weight(cpu_idlers);
         weight_nxt = cpus_weight(nxt_idlers);
         /* smt_power_savings: consolidate work rather than spreading it */
-        if ( ( sched_smt_power_savings
-               && (weight_cpu > weight_nxt) )
-             || ( !sched_smt_power_savings
-                  && (weight_cpu * migrate_factor < weight_nxt) ) )
+        if ( sched_smt_power_savings ?
+             weight_cpu > weight_nxt :
+             weight_cpu * migrate_factor < weight_nxt )
         {
             cpus_and(nxt_idlers, cpus, nxt_idlers);
             spc = CSCHED_PCPU(nxt);

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

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

^ permalink raw reply	[flat|nested] only message in thread

only message in thread, other threads:[~2011-03-14 17:05 UTC | newest]

Thread overview: (only message) (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2011-03-14 17:05 [PATCH 3/3] _csched_cpu_pick(): simplify sched_smt_power_savings dependent condition Jan Beulich

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).