Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > linux.kernel > #1538733

[PATCH 1/2 v3] sched: fix find_idlest_group for fork

From Vincent Guittot <vincent.guittot@linaro.org>
Newsgroups linux.kernel
Subject [PATCH 1/2 v3] sched: fix find_idlest_group for fork
Date 2016-12-08 18:00 +0100
Message-ID <sMad4-8vg-27@gated-at.bofh.it> (permalink)
References <sMad4-8vg-21@gated-at.bofh.it>
Organization linux.* mail to news gateway

Show all headers | View raw


During fork, the utilization of a task is init once the rq has been
selected because the current utilization level of the rq is used to set
the utilization of the fork task. As the task's utilization is still
null at this step of the fork sequence, it doesn't make sense to look for
some spare capacity that can fit the task's utilization.
Furthermore, I can see perf regressions for the test "hackbench -P -g 1"
because the least loaded policy is always bypassed and tasks are not
spread during fork.

With this patch and the fix below, we are back to same performances as
for v4.8. The fix below is only a temporary one used for the test until a
smarter solution is found because we can't simply remove the test which is
useful for others benchmarks

@@ -5708,13 +5708,6 @@ static int select_idle_cpu(struct task_struct *p, struct sched_domain *sd, int t

 	avg_cost = this_sd->avg_scan_cost;

-	/*
-	 * Due to large variance we need a large fuzz factor; hackbench in
-	 * particularly is sensitive here.
-	 */
-	if ((avg_idle / 512) < avg_cost)
-		return -1;
-
 	time = local_clock();

 	for_each_cpu_wrap(cpu, sched_domain_span(sd), target, wrap) {

Signed-off-by: Vincent Guittot <vincent.guittot@linaro.org>
Acked-by: Morten Rasmussen <morten.rasmussen@arm.com>
---
 kernel/sched/fair.c | 6 ++++++
 1 file changed, 6 insertions(+)

diff --git a/kernel/sched/fair.c b/kernel/sched/fair.c
index 92cb50d..1da846b 100644
--- a/kernel/sched/fair.c
+++ b/kernel/sched/fair.c
@@ -5473,13 +5473,19 @@ find_idlest_group(struct sched_domain *sd, struct task_struct *p,
 	 * utilized systems if we require spare_capacity > task_util(p),
 	 * so we allow for some task stuffing by using
 	 * spare_capacity > task_util(p)/2.
+	 * spare capacity can't be used for fork because the utilization has
+	 * not been set yet as it need to get a rq to init the utilization
 	 */
+	if (sd_flag & SD_BALANCE_FORK)
+		goto skip_spare;
+
 	if (this_spare > task_util(p) / 2 &&
 	    imbalance*this_spare > 100*most_spare)
 		return NULL;
 	else if (most_spare > task_util(p) / 2)
 		return most_spare_sg;
 
+skip_spare:
 	if (!idlest || 100*this_load < imbalance*min_load)
 		return NULL;
 	return idlest;
-- 
2.7.4

Back to linux.kernel | Previous | NextPrevious in thread | Next in thread | Find similar | Unroll thread


Thread

[PATCH 0/2 v3] sched: improve spread of tasks during fork Vincent Guittot <vincent.guittot@linaro.org> - 2016-12-08 18:00 +0100
  [PATCH 1/2 v3] sched: fix find_idlest_group for fork Vincent Guittot <vincent.guittot@linaro.org> - 2016-12-08 18:00 +0100
    Re: [PATCH 1/2 v3] sched: fix find_idlest_group for fork Matt Fleming <matt@codeblueprint.co.uk> - 2016-12-09 14:20 +0100
  [PATCH 2/2 v3] sched: use load_avg for selecting idlest group Vincent Guittot <vincent.guittot@linaro.org> - 2016-12-08 18:00 +0100
    Re: [PATCH 2/2 v3] sched: use load_avg for selecting idlest group Matt Fleming <matt@codeblueprint.co.uk> - 2016-12-09 14:30 +0100
    Re: [PATCH 2/2 v3] sched: use load_avg for selecting idlest group Peter Zijlstra <peterz@infradead.org> - 2016-12-09 16:30 +0100
      Re: [PATCH 2/2 v3] sched: use load_avg for selecting idlest group Vincent Guittot <vincent.guittot@linaro.org> - 2016-12-09 17:30 +0100

csiph-web