mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: Alex Shi <alex.shi@intel.com>
To: Namhyung Kim <namhyung@kernel.org>
Cc: Preeti U Murthy <preeti@linux.vnet.ibm.com>,
	Mike Galbraith <bitbucket@online.de>,
	LKML <linux-kernel@vger.kernel.org>,
	"svaidy@linux.vnet.ibm.com" <svaidy@linux.vnet.ibm.com>,
	"Paul E. McKenney" <paulmck@linux.vnet.ibm.com>,
	Vincent Guittot <vincent.guittot@linaro.org>,
	Peter Zijlstra <a.p.zijlstra@chello.nl>,
	Viresh Kumar <viresh.kumar@linaro.org>,
	Amit Kucheria <amit.kucheria@linaro.org>,
	Morten Rasmussen <Morten.Rasmussen@arm.com>,
	Paul McKenney <paul.mckenney@linaro.org>,
	Andrew Morton <akpm@linux-foundation.org>,
	Arjan van de Ven <arjan@linux.intel.com>,
	Ingo Molnar <mingo@kernel.org>, Paul Turner <pjt@google.com>,
	Venki Pallipadi <venki@google.com>,
	Robin Randhawa <robin.randhawa@arm.com>,
	Lists linaro-dev <linaro-dev@lists.linaro.org>,
	Matthew Garrett <mjg59@srcf.ucam.org>,
	srikar@linux.vnet.ibm.com
Subject: Re: sched: Consequences of integrating the Per Entity Load Tracking Metric into the Load Balancer
Date: Thu, 24 Jan 2013 11:13:59 +0800	[thread overview]
Message-ID: <5100A6F7.4080109@intel.com> (raw)
In-Reply-To: <50F7FF79.6080603@intel.com>


>>
>> Maybe we can skip local group since it's a bottom-up search so we know
>> there's no idle cpu in the lower domain from the prior iteration.
>>
> 
> I did this change but seems results are worse on my machines, guess start seeking idle cpu bottom up is a bad idea.
> The following is full version with above change.
> 

also tried to keep top-down seeking mode, and will return any idle cpu
instead of the first cpu in a idle group. But the result doesn't show
better on benchmark hackbench.

===
diff --git a/kernel/sched/fair.c b/kernel/sched/fair.c
index 5eea870..fb85094 100644
--- a/kernel/sched/fair.c
+++ b/kernel/sched/fair.c
@@ -3169,6 +3169,7 @@ static int wake_affine(struct sched_domain *sd,
struct task_struct *p, int sync)
  		return 1;
 	}
+	/* bias toward prev cpu */
 	return 0;
 }
 @@ -3252,7 +3253,8 @@ find_idlest_cpu(struct sched_group *group, struct
task_struct *p, int this_cpu)
 /*
  * Try and locate an idle CPU in the sched_domain.
  */
-static int select_idle_sibling(struct task_struct *p, int target)
+static int select_idle_sibling(struct task_struct *p,
+				struct sched_domain *affine_sd, int sync)
 {
 	int cpu = smp_processor_id();
 	int prev_cpu = task_cpu(p);
@@ -3264,20 +3266,23 @@ static int select_idle_sibling(struct
task_struct *p, int target)
 	 * If the task is going to be woken-up on this cpu and if it is
 	 * already idle, then it is the right target.
 	 */
-	if (target == cpu && idle_cpu(cpu))
+	if (idle_cpu(cpu))
 		return cpu;
  	/*
 	 * If the task is going to be woken-up on the cpu where it previously
 	 * ran and if it is currently idle, then it the right target.
 	 */
-	if (target == prev_cpu && idle_cpu(prev_cpu))
+	if (cpu != prev_cpu && idle_cpu(prev_cpu))
 		return prev_cpu;
 +	if (cpu != prev_cpu && !wake_affine(affine_sd, p, sync))
+		cpu = prev_cpu;
+
 	/*
 	 * Otherwise, iterate the domains and find an elegible idle cpu.
 	 */
-	sd = rcu_dereference(per_cpu(sd_llc, target));
+	sd = rcu_dereference(per_cpu(sd_llc, cpu));
 	for_each_lower_domain(sd) {
 		sg = sd->groups;
 		do {
@@ -3290,7 +3295,7 @@ static int select_idle_sibling(struct task_struct
*p, int target)
 					goto next;
 			}
 -			target = cpumask_first_and(sched_group_cpus(sg),
+			cpu = cpumask_first_and(sched_group_cpus(sg),
 					tsk_cpus_allowed(p));
 			goto done;
 next:
@@ -3298,7 +3303,7 @@ next:
 		} while (sg != sd->groups);
 	}
 done:
-	return target;
+	return cpu;
 }
  /*
@@ -3351,10 +3356,7 @@ select_task_rq_fair(struct task_struct *p, int
sd_flag, int wake_flags)
 	}
  	if (affine_sd) {
-		if (cpu != prev_cpu && wake_affine(affine_sd, p, sync))
-			prev_cpu = cpu;
-
-		new_cpu = select_idle_sibling(p, prev_cpu);
+		new_cpu = select_idle_sibling(p, affine_sd, sync);
 		goto unlock;
 	}


  reply	other threads:[~2013-01-24  3:13 UTC|newest]

Thread overview: 24+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2013-01-02  4:22 Preeti U Murthy
2013-01-02  8:12 ` Mike Galbraith
2013-01-03 10:38   ` Preeti U Murthy
2013-01-03 20:06     ` Mike Galbraith
2013-01-04 11:41     ` Mike Galbraith
2013-01-05  8:13     ` Mike Galbraith
2013-01-06 16:32       ` Mike Galbraith
2013-01-07  5:29         ` Preeti U Murthy
2013-01-07  7:36           ` Mike Galbraith
2013-01-08  8:41             ` Preeti U Murthy
2013-01-16 14:08               ` Alex Shi
2013-01-17  5:17                 ` Namhyung Kim
2013-01-17 10:16                   ` Preeti U Murthy
2013-01-17 13:41                   ` Alex Shi
2013-01-24  3:13                     ` Alex Shi [this message]
2013-01-17  8:45                 ` Preeti U Murthy
2013-01-07 15:48 ` Vincent Guittot
2013-01-08  6:06   ` Preeti U Murthy
2013-01-08 14:04     ` Vincent Guittot
2013-01-09  3:14       ` Preeti U Murthy
2013-01-20 15:30         ` Alex Shi
2013-01-20 15:52           ` Alex Shi
2013-01-21  2:40             ` Preeti U Murthy
2013-01-21  3:26               ` Alex Shi

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=5100A6F7.4080109@intel.com \
    --to=alex.shi@intel.com \
    --cc=Morten.Rasmussen@arm.com \
    --cc=a.p.zijlstra@chello.nl \
    --cc=akpm@linux-foundation.org \
    --cc=amit.kucheria@linaro.org \
    --cc=arjan@linux.intel.com \
    --cc=bitbucket@online.de \
    --cc=linaro-dev@lists.linaro.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=mingo@kernel.org \
    --cc=mjg59@srcf.ucam.org \
    --cc=namhyung@kernel.org \
    --cc=paul.mckenney@linaro.org \
    --cc=paulmck@linux.vnet.ibm.com \
    --cc=pjt@google.com \
    --cc=preeti@linux.vnet.ibm.com \
    --cc=robin.randhawa@arm.com \
    --cc=srikar@linux.vnet.ibm.com \
    --cc=svaidy@linux.vnet.ibm.com \
    --cc=venki@google.com \
    --cc=vincent.guittot@linaro.org \
    --cc=viresh.kumar@linaro.org \
    /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

Powered by JetHome