Received: by 2002:ac0:a581:0:0:0:0:0 with SMTP id m1-v6csp520295imm; Wed, 20 Jun 2018 02:08:46 -0700 (PDT) X-Google-Smtp-Source: ADUXVKIj2ZmLyN6bs6NiZUwMhX5pXpjVP7Wz/e6GYaJC5BHXsfQxUIloe4w+o2uH/E2HVmJIRDMO X-Received: by 2002:a17:902:4c88:: with SMTP id b8-v6mr22004504ple.285.1529485726099; Wed, 20 Jun 2018 02:08:46 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1529485726; cv=none; d=google.com; s=arc-20160816; b=sAL9wcAWqF4YI5JcYyQZ438srDfLtAbzE4ydpqdDNWdoAVDbhwHk2XSwTykos3iwCy ZFZ9AU8tIoypwCTy3ggFkL2K0jAQf94V7JuhmGUOxSOloHaoDpi2Q/1AR8bUUMK8jMPF L7+Pen6YCulQnJlNEejs/+0dWBaxxekQOwE9jfgYJSf8ZHvErga6793hG14Gi5Ucr4P3 QchFd8Kynu65Myk5gAMCghEh1KWlII8Ay0jccoDjEKiIDcCaGuFR/7hfJkPfGLJHdhZc KjNtDq9owlS0sjVLdk1G2oiuC32B9S+eZC92oYEOqfkphJTkRveDFtfH3GfYzuMsQv2i hNYA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:references:in-reply-to:message-id:date :subject:cc:to:from:arc-authentication-results; bh=Ihks1o5t2yYp54YOLSG3b14P3NZQSuiAyS0lFE9uutU=; b=lI87SAmfh9Jt20+krTmZW/eXqaxMHY9ZbIbrh3L+k4ViXo4D2ECoKBRmriIa8eCdD4 ZDMJpH/K0uQCJPK5QtdrQegrjXbI0quxBoiVnTdO70Ve1Sa2WDqiqt1sQ52q39yUm6+w yRpHctZFKP/vKxRTjf7YDwYFSd3shCVmMcnXUSepuMH8JEtzSTWVGU4JthrqzSAxreYg WnyNIV9tZrYmx/FMCLhN9pcupgZWIj9/tvamZW8mzhebzDXNakII/ONEF0bfdfPf/h0X Y1aw1iyS1UJaAsab9luJ2yIYXcerSWuZQpkdbLheglWSN49BQpzYPQJyx1YFvVi5mTRm 7K5w== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id h16-v6si1974420pfk.156.2018.06.20.02.08.32; Wed, 20 Jun 2018 02:08:46 -0700 (PDT) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S932685AbeFTJHq (ORCPT + 99 others); Wed, 20 Jun 2018 05:07:46 -0400 Received: from usa-sjc-mx-foss1.foss.arm.com ([217.140.101.70]:34028 "EHLO foss.arm.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1754838AbeFTJGw (ORCPT ); Wed, 20 Jun 2018 05:06:52 -0400 Received: from usa-sjc-imap-foss1.foss.arm.com (unknown [10.72.51.249]) by usa-sjc-mx-foss1.foss.arm.com (Postfix) with ESMTP id 6FD4C1684; Wed, 20 Jun 2018 02:06:52 -0700 (PDT) Received: from e105550-lin.cambridge.arm.com (e105550-lin.cambridge.arm.com [10.1.211.30]) by usa-sjc-imap-foss1.foss.arm.com (Postfix) with ESMTPA id ECB643F246; Wed, 20 Jun 2018 02:06:50 -0700 (PDT) From: Morten Rasmussen To: peterz@infradead.org, mingo@redhat.com Cc: valentin.schneider@arm.com, dietmar.eggemann@arm.com, vincent.guittot@linaro.org, gaku.inami.xh@renesas.com, linux-kernel@vger.kernel.org, Morten Rasmussen Subject: [PATCHv3 8/9] sched/fair: Set sd->overload when misfit Date: Wed, 20 Jun 2018 10:05:48 +0100 Message-Id: <1529485549-5191-9-git-send-email-morten.rasmussen@arm.com> X-Mailer: git-send-email 2.7.4 In-Reply-To: <1529485549-5191-1-git-send-email-morten.rasmussen@arm.com> References: <1529485549-5191-1-git-send-email-morten.rasmussen@arm.com> Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org From: Valentin Schneider Idle balance is a great opportunity to pull a misfit task. However, there are scenarios where misfit tasks are present but idle balance is prevented by the overload flag. A good example of this is a workload of n identical tasks. Let's suppose we have a 2+2 Arm big.LITTLE system. We then spawn 4 fairly CPU-intensive tasks - for the sake of simplicity let's say they are just CPU hogs, even when running on big CPUs. They are identical tasks, so on an SMP system they should all end at (roughly) the same time. However, in our case the LITTLE CPUs are less performing than the big CPUs, so tasks running on the LITTLEs will have a longer completion time. This means that the big CPUs will complete their work earlier, at which point they should pull the tasks from the LITTLEs. What we want to happen is summarized as follows: a,b,c,d are our CPU-hogging tasks _ signifies idling LITTLE_0 | a a a a _ _ LITTLE_1 | b b b b _ _ ---------|------------- big_0 | c c c c a a big_1 | d d d d b b ^ ^ Tasks end on the big CPUs, idle balance happens and the misfit tasks are pulled straight away This however won't happen, because currently the overload flag is only set when there is any CPU that has more than one runnable task - which may very well not be the case here if our CPU-hogging workload is all there is to run. As such, this commit sets the overload flag in update_sg_lb_stats when a group is flagged as having a misfit task. cc: Ingo Molnar cc: Peter Zijlstra Signed-off-by: Valentin Schneider Signed-off-by: Morten Rasmussen --- kernel/sched/fair.c | 6 ++++-- kernel/sched/sched.h | 6 +++++- 2 files changed, 9 insertions(+), 3 deletions(-) diff --git a/kernel/sched/fair.c b/kernel/sched/fair.c index 9dd147c71dd0..aac7b9155bc4 100644 --- a/kernel/sched/fair.c +++ b/kernel/sched/fair.c @@ -8165,7 +8165,7 @@ static bool update_nohz_stats(struct rq *rq, bool force) * @load_idx: Load index of sched_domain of this_cpu for load calc. * @local_group: Does group contain this_cpu. * @sgs: variable to hold the statistics for this group. - * @overload: Indicate more than one runnable task for any CPU. + * @overload: Indicate pullable load (e.g. >1 runnable task). */ static inline void update_sg_lb_stats(struct lb_env *env, struct sched_group *group, int load_idx, @@ -8209,8 +8209,10 @@ static inline void update_sg_lb_stats(struct lb_env *env, sgs->idle_cpus++; if (env->sd->flags & SD_ASYM_CPUCAPACITY && - sgs->group_misfit_task_load < rq->misfit_task_load) + sgs->group_misfit_task_load < rq->misfit_task_load) { sgs->group_misfit_task_load = rq->misfit_task_load; + *overload = 1; + } } /* Adjust by relative CPU capacity of the group */ diff --git a/kernel/sched/sched.h b/kernel/sched/sched.h index 791d9badad31..6dfab618e457 100644 --- a/kernel/sched/sched.h +++ b/kernel/sched/sched.h @@ -688,7 +688,11 @@ struct root_domain { cpumask_var_t span; cpumask_var_t online; - /* Indicate more than one runnable task for any CPU */ + /* + * Indicate pullable load on at least one CPU, e.g: + * - More than one runnable task + * - Running task is misfit + */ int overload; /* -- 2.7.4