Received: by 10.192.165.156 with SMTP id m28csp1271095imm; Fri, 13 Apr 2018 16:58:08 -0700 (PDT) X-Google-Smtp-Source: AIpwx4/9jjHUJZIUfuOclvCmC1Nddbxx44Y9Fw3Vgz9N80UkI9z1lNaMJxZ+SAVC68TL2gez3pAl X-Received: by 2002:a17:902:70c4:: with SMTP id l4-v6mr6968253plt.382.1523663888405; Fri, 13 Apr 2018 16:58:08 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1523663888; cv=none; d=google.com; s=arc-20160816; b=Wu1zVx0+tMyQkd59/LwDxNxBsqXa/r+UxfWvV43XJ3CSz9UoBexB3/7Bw1O4rJ93iI pKbwmdSsyTiDAr5JyZlHenlmgV7sKX/g+x5uDl54q9Azj+UP0qLVp3uFZERIx2FHtBn+ 6rnyzmDxc8o+ixyPgGXZuwVNqS/NXDtfa6srO8vMi0iOKnGGYjLgLE2sld1i298PiV1Q QJ+Yp3wFAVLd/30BUFUloaIISeOsZa1xh9VZVQw5CKMWJ3nbUIstITnL+JxgoYdaGvkZ x0D86tA4zhp0f5bE0TExDlmGNrn+AF0Vxy8Ajq+pqzzWpMEZIUNA/sEvLhq6c7xI/AYL ZJLw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:cc:to:subject:message-id:date:from :references:in-reply-to:mime-version:dkim-signature :arc-authentication-results; bh=8gB3+5EHgLxPB8I0r3d+nY6ETZTMnQQWhJgCIm5YM/4=; b=rex8touF9I/aXm79npKCp3k7eoILt8uPUulSLKjmerVp2JqAZEj9oihUs+xusxk3Pv HnCRd6pbtZfXTze6gpICZ29i2X900C7Qi5oHz3YVWJY1lqpucBsNuGDfP1Vcf3J23spt h7dLur9pxJV5aoUuyfc8HUUgeCq/ycNd51Ws1WoAmP+2u/Cwx3Ie+JVgJm9Z4I3fRMiy JVVBkCzW2AWLK6aDTUsb7+XNGZfmuaiKmGBPdE8uxB4ODumYkTczs5sLt3Lw2Vour1Rf 8u7w1/+3FN8dzLidYgFjcrif5YYjF3GuUSgxTes2n7V80o+3+T4iljv8vDCT+rKOCYQi Eerw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@google.com header.s=20161025 header.b=d2nykdHb; 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; dmarc=pass (p=REJECT sp=REJECT dis=NONE) header.from=google.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id n13si5592234pfg.227.2018.04.13.16.57.54; Fri, 13 Apr 2018 16:58:08 -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; dkim=pass header.i=@google.com header.s=20161025 header.b=d2nykdHb; 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; dmarc=pass (p=REJECT sp=REJECT dis=NONE) header.from=google.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1751782AbeDMX4n (ORCPT + 99 others); Fri, 13 Apr 2018 19:56:43 -0400 Received: from mail-io0-f194.google.com ([209.85.223.194]:42862 "EHLO mail-io0-f194.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751042AbeDMX4l (ORCPT ); Fri, 13 Apr 2018 19:56:41 -0400 Received: by mail-io0-f194.google.com with SMTP id d5so12046679iob.9 for ; Fri, 13 Apr 2018 16:56:41 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=20161025; h=mime-version:in-reply-to:references:from:date:message-id:subject:to :cc; bh=8gB3+5EHgLxPB8I0r3d+nY6ETZTMnQQWhJgCIm5YM/4=; b=d2nykdHbmSGNMywkiYAm4Tq9968NyTxiAT9Zuv7Zmt4QsQpT0Qg9Je6UQFH7fhrLP0 T96De3U3G+IDOKRdUFfiWnnzF20eRoZ8b1SZqyr/DVhfEo8E6OOYk8KEepu9kLEf6KXL ynxrtgVnfhkh+XlDFrMteMb/lUk0wImp+CBfaeuEtbCImC2jHLpwYahiHqIl/LJErtCj UftFg41wj1K2g2MSrHMcnqs3qbKbwGWP2RHjXMEv9JC0vHuVDW+4FURAF1dEdh0CSpCC TlcCp0VCoQeWTmppIojad7eI4ZRU4koQeBYpqVsUcYj3nY0cLC3gXrS5LU/WHaXheof+ OhtQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:mime-version:in-reply-to:references:from:date :message-id:subject:to:cc; bh=8gB3+5EHgLxPB8I0r3d+nY6ETZTMnQQWhJgCIm5YM/4=; b=jncABaLJ0chswuDHCM9RNAK0A1deHpst7tJOpFHqKdsSGzxOvS823siw09A5dB7RL6 rhq2wLTe7cZUv+fD4Fyy05+u3ApXmi/KyvFCFmSy9olpbSdhgejiGMH7Kb/gM40Ujsol bLKHGioDpM482o6++3SPqEnSZj+m2/Nk8X+eTjCveQMrY3Wz8TddI4zYXkN8D83dMj8X jDyhhT7mwECtfdMhrNl0bs2/0l0AGN9ZDHr3mKuoUXZlBf04NINIu48otW4F/6BwhiQN 1HofCmLuyVTl4925r8X4WTKx6hxrDDz1bi4/c3wXikHL0rFhLlwT6zb/LEyYawxFdtl6 VSfQ== X-Gm-Message-State: ALQs6tDSzmpLPBQPDTAobCALfqZLm+Ia5pFgukivJk427th3FZZhKckV 07q9sHALVD9c+gZJo4Ev8Pym/D+qi+0QEenkQZyT7A== X-Received: by 10.107.132.72 with SMTP id g69mr3680642iod.251.1523663800257; Fri, 13 Apr 2018 16:56:40 -0700 (PDT) MIME-Version: 1.0 Received: by 10.107.181.213 with HTTP; Fri, 13 Apr 2018 16:56:39 -0700 (PDT) In-Reply-To: <20180406153607.17815-4-dietmar.eggemann@arm.com> References: <20180406153607.17815-1-dietmar.eggemann@arm.com> <20180406153607.17815-4-dietmar.eggemann@arm.com> From: Joel Fernandes Date: Fri, 13 Apr 2018 16:56:39 -0700 Message-ID: Subject: Re: [RFC PATCH v2 3/6] sched: Add over-utilization/tipping point indicator To: Dietmar Eggemann Cc: LKML , Peter Zijlstra , Quentin Perret , Thara Gopinath , Linux PM , Morten Rasmussen , Chris Redpath , Patrick Bellasi , Valentin Schneider , "Rafael J . Wysocki" , Greg Kroah-Hartman , Vincent Guittot , Viresh Kumar , Todd Kjos , Juri Lelli , Steve Muckle , Eduardo Valentin Content-Type: text/plain; charset="UTF-8" Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Hi, On Fri, Apr 6, 2018 at 8:36 AM, Dietmar Eggemann wrote: > From: Thara Gopinath > > Energy-aware scheduling should only operate when the system is not > overutilized. There must be cpu time available to place tasks based on > utilization in an energy-aware fashion, i.e. to pack tasks on > energy-efficient cpus without harming the overall throughput. > > In case the system operates above this tipping point the tasks have to > be placed based on task and cpu load in the classical way of spreading > tasks across as many cpus as possible. > > The point in which a system switches from being not overutilized to > being overutilized is called the tipping point. > > Such a tipping point indicator on a sched domain as the system > boundary is introduced here. As soon as one cpu of a sched domain is > overutilized the whole sched domain is declared overutilized as well. > A cpu becomes overutilized when its utilization is higher that 80% > (capacity_margin) of its capacity. > > The implementation takes advantage of the shared sched domain which is > shared across all per-cpu views of a sched domain level. The new > overutilized flag is placed in this shared sched domain. > > Load balancing is skipped in case the energy model is present and the > sched domain is not overutilized because under this condition the > predominantly load-per-capacity driven load-balancer should not > interfere with the energy-aware wakeup placement based on utilization. > > In case the total utilization of a sched domain is greater than the > total sched domain capacity the overutilized flag is set at the parent > sched domain level to let other sched groups help getting rid of the > overutilization of cpus. > > Signed-off-by: Thara Gopinath > Signed-off-by: Dietmar Eggemann > --- > include/linux/sched/topology.h | 1 + > kernel/sched/fair.c | 62 ++++++++++++++++++++++++++++++++++++++++-- > kernel/sched/sched.h | 1 + > kernel/sched/topology.c | 12 +++----- > 4 files changed, 65 insertions(+), 11 deletions(-) > > diff --git a/include/linux/sched/topology.h b/include/linux/sched/topology.h > index 26347741ba50..dd001c232646 100644 > --- a/include/linux/sched/topology.h > +++ b/include/linux/sched/topology.h > @@ -72,6 +72,7 @@ struct sched_domain_shared { > atomic_t ref; > atomic_t nr_busy_cpus; > int has_idle_cores; > + int overutilized; > }; > > struct sched_domain { > diff --git a/kernel/sched/fair.c b/kernel/sched/fair.c > index 0a76ad2ef022..6960e5ef3c14 100644 > --- a/kernel/sched/fair.c > +++ b/kernel/sched/fair.c > @@ -5345,6 +5345,28 @@ static inline void hrtick_update(struct rq *rq) > } > #endif > > +#ifdef CONFIG_SMP > +static inline int cpu_overutilized(int cpu); > + > +static inline int sd_overutilized(struct sched_domain *sd) > +{ > + return READ_ONCE(sd->shared->overutilized); > +} > + > +static inline void update_overutilized_status(struct rq *rq) > +{ > + struct sched_domain *sd; > + > + rcu_read_lock(); > + sd = rcu_dereference(rq->sd); > + if (sd && !sd_overutilized(sd) && cpu_overutilized(rq->cpu)) > + WRITE_ONCE(sd->shared->overutilized, 1); > + rcu_read_unlock(); > +} > +#else > +static inline void update_overutilized_status(struct rq *rq) {} > +#endif /* CONFIG_SMP */ > + > /* > * The enqueue_task method is called before nr_running is > * increased. Here we update the fair scheduling stats and > @@ -5394,8 +5416,10 @@ enqueue_task_fair(struct rq *rq, struct task_struct *p, int flags) > update_cfs_group(se); > } > > - if (!se) > + if (!se) { > add_nr_running(rq, 1); > + update_overutilized_status(rq); > + } I'm wondering if it makes sense for considering scenarios whether other classes cause CPUs in the domain to go above the tipping point. Then in that case also, it makes sense to not to do EAS in that domain because of the overutilization. I guess task_fits using cpu_util which is PELT only at the moment... so may require some other method like aggregation of CFS PELT, with RT-PELT and DL running bw or something. thanks, - Joel