Received: by 2002:ac0:a5a6:0:0:0:0:0 with SMTP id m35-v6csp2572670imm; Mon, 10 Sep 2018 03:19:41 -0700 (PDT) X-Google-Smtp-Source: ANB0VdbtVOMAJsV40tIfH2P55wwYQK2sAEdLmdQJJf41M6OIbrKoC47h9Wjtw+n6NhHE2/kpXNzh X-Received: by 2002:a63:4a09:: with SMTP id x9-v6mr21082715pga.34.1536574781317; Mon, 10 Sep 2018 03:19:41 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1536574781; cv=none; d=google.com; s=arc-20160816; b=jDknmvbAH2K5Yt23KPaNjMyyE4NRa4C2q+rbYpt2/MPhhLrKFGsigJBCWKavkogy6y DnwzF8fDjSY/2xjQcDNWOBpXj02FHMctzAR1FaGilxvatonSAAoJHjCaJo0TUvUXt1ZC GJvIduM/K3WH8j2eUpD/g9VmxbkIuCFG3YQc78gTX/4VDmwMiglGx4fqlJmj/+LwnKWy b3P+hnoxAYt1m5spAN5VXy3zii2oxo4eTlvX0QfmHjswFmI5+UNv38V2wNRH62iHcplK oqsuCDImf7YmQ60r8ga5Ow3JCaJmL0uKTa0JdBYPks/6gmPIy0WNo3w1rbTpbJ6r+6kE dLcw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:content-disposition :content-transfer-encoding:mime-version:robot-unsubscribe:robot-id :git-commit-id:subject:to:references:in-reply-to:reply-to:cc :message-id:from:date; bh=pYtnu8GNbDTZcMFjkX6QEXTlQcW9OE/A8Nv3qIPbVxY=; b=QhDoM4xGzt5WoucPYos9C4SZUnL6eLt9u3LnSka+Qd4r9rw59tQQ/8Ndp6GJQ6/uXp KLWkpmWOwJV1wzi5hVAld688RW/VaNkuPfuncGS7VOjLrg06dr9tu9OJn3La+V17Khdn 3TGJDQ/6VGG5D8XTduW4QhZ4s9DHqXgUZ+BTcLCuE8DjXvG6svEvSkG8mzhdG3oKlaTD ctpaisqvku+pRr8A8yGr4Vvl8VrcmJeg7/cFCbhgC/A598oCdgaOsjEFGnpEK7C1O/Bl ElmeQqdx3QK4M0d9vy0ZpvTpqBZug0sBC1HT4OUm8NfKKzqq2LaqYwYtWLBo3xfBino5 Ot6A== 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 a21-v6si16424184pfo.68.2018.09.10.03.19.26; Mon, 10 Sep 2018 03:19:41 -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 S1728307AbeIJPLU (ORCPT + 99 others); Mon, 10 Sep 2018 11:11:20 -0400 Received: from terminus.zytor.com ([198.137.202.136]:39513 "EHLO terminus.zytor.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1728210AbeIJPLU (ORCPT ); Mon, 10 Sep 2018 11:11:20 -0400 Received: from terminus.zytor.com (localhost [127.0.0.1]) by terminus.zytor.com (8.15.2/8.15.2) with ESMTPS id w8AAHcBE1808381 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NO); Mon, 10 Sep 2018 03:17:38 -0700 Received: (from tipbot@localhost) by terminus.zytor.com (8.15.2/8.15.2/Submit) id w8AAHcEE1808378; Mon, 10 Sep 2018 03:17:38 -0700 Date: Mon, 10 Sep 2018 03:17:38 -0700 X-Authentication-Warning: terminus.zytor.com: tipbot set sender to tipbot@zytor.com using -f From: tip-bot for Valentin Schneider Message-ID: Cc: valentin.schneider@arm.com, hpa@zytor.com, peterz@infradead.org, torvalds@linux-foundation.org, tglx@linutronix.de, morten.rasmussen@arm.com, mingo@kernel.org, linux-kernel@vger.kernel.org Reply-To: mingo@kernel.org, linux-kernel@vger.kernel.org, morten.rasmussen@arm.com, tglx@linutronix.de, torvalds@linux-foundation.org, peterz@infradead.org, hpa@zytor.com, valentin.schneider@arm.com In-Reply-To: <1530699470-29808-10-git-send-email-morten.rasmussen@arm.com> References: <1530699470-29808-10-git-send-email-morten.rasmussen@arm.com> To: linux-tip-commits@vger.kernel.org Subject: [tip:sched/core] sched/fair: Set rq->rd->overload when misfit Git-Commit-ID: 757ffdd705ee942fc8150b17942d968601d2a15b X-Mailer: tip-git-log-daemon Robot-ID: Robot-Unsubscribe: Contact to get blacklisted from these emails MIME-Version: 1.0 Content-Transfer-Encoding: 8bit Content-Type: text/plain; charset=UTF-8 Content-Disposition: inline X-Spam-Status: No, score=-2.9 required=5.0 tests=ALL_TRUSTED,BAYES_00, T_DATE_IN_FUTURE_96_Q autolearn=ham autolearn_force=no version=3.4.1 X-Spam-Checker-Version: SpamAssassin 3.4.1 (2015-04-28) on terminus.zytor.com Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Commit-ID: 757ffdd705ee942fc8150b17942d968601d2a15b Gitweb: https://git.kernel.org/tip/757ffdd705ee942fc8150b17942d968601d2a15b Author: Valentin Schneider AuthorDate: Wed, 4 Jul 2018 11:17:47 +0100 Committer: Ingo Molnar CommitDate: Mon, 10 Sep 2018 11:05:53 +0200 sched/fair: Set rq->rd->overload when misfit 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. Signed-off-by: Valentin Schneider Signed-off-by: Morten Rasmussen Signed-off-by: Peter Zijlstra (Intel) Cc: Linus Torvalds Cc: Peter Zijlstra Cc: Thomas Gleixner Cc: dietmar.eggemann@arm.com Cc: gaku.inami.xh@renesas.com Cc: vincent.guittot@linaro.org Link: http://lkml.kernel.org/r/1530699470-29808-10-git-send-email-morten.rasmussen@arm.com Signed-off-by: Ingo Molnar --- 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 d9c4e97bfebd..8b228c5b3eb4 100644 --- a/kernel/sched/fair.c +++ b/kernel/sched/fair.c @@ -7793,7 +7793,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, @@ -7837,8 +7837,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 938063639793..85b3a2bf6c2b 100644 --- a/kernel/sched/sched.h +++ b/kernel/sched/sched.h @@ -715,7 +715,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; /*