Received: by 10.213.65.68 with SMTP id h4csp261403imn; Tue, 20 Mar 2018 02:53:59 -0700 (PDT) X-Google-Smtp-Source: AG47ELsmOLr6u3ZHi/3CJHdBS6jaOMpnx3VyeGW1GeRg05o5uZAxFMQp8iECdwYwrnYq6HVvMvnw X-Received: by 2002:a17:902:51ca:: with SMTP id y68-v6mr10057015plh.25.1521539639330; Tue, 20 Mar 2018 02:53:59 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1521539639; cv=none; d=google.com; s=arc-20160816; b=kMbH3DwQD6oaojwWmRtaLlaPOQc0QpZDRzbrSxh4+q8Ws+VYnvPZ8fCy7xNLTm8Xar MmCP6OxS34OjFX2zBID5tqkRpehzCtHzXKLfJifOsw4NW5cYYQdQbgkcDG/PBbdHwL3I Nk2ZKtV50Ao7i8cAuELXLgTaTlOTXDlZBywYSnAwy+65Ep/R/97hBmfDO7W3u66+6iMo 73UlSpSI8Bc8BnSpEZ7mXZSfM9wPrllZ0eDEt0kpPsXjKQfCsUKMEiWgOWZZwVL3Yfcw r/sbvCdTM1CPtd9TIx5r7vvUSUYk2Vn4XCJw2U23BD8Ti7WV1rU70Z62cgNWgl3XRhjx JQfA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:user-agent:in-reply-to :content-disposition:mime-version:references:message-id:subject:cc :to:from:date:arc-authentication-results; bh=QHKsU6o/14gsqztsyWE1Wv305JJ4pZvZ/6roUyIEXkM=; b=iTCKQHe591Tvb/xCFXKEf32obNx8YG1C/IBb2maHcdn1rUvXKMaYPsddNdRU6YkA1F fGOb5fGbv7KEGdAmbgJck2AHjKpnyVCuzB6Q/RiNNIUqyQwb4QaCzOLSB2U6Lskk/4GI KaRmJsQ1C9hYjoeQMoQwYGeQ4HOhfQHNwFRc5GybFuM+vKqEgmIUDg6nwaFx0AWTNrcf yjbuBKESxAHOMq/ac9KUYG9G/Bt4TI5Xv3NhPl4ndeb0eP0pMADygUjay5830RpINW5h XHo/iUDQH9ov/acfoxp6h/12YFjVCeIdzQ7N+YLBuIPmypCZ9X0JbbrlDBsF7olsZUS/ vhWg== 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 i12-v6si1284693plk.508.2018.03.20.02.53.41; Tue, 20 Mar 2018 02:53:59 -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 S1752563AbeCTJwX (ORCPT + 99 others); Tue, 20 Mar 2018 05:52:23 -0400 Received: from mail.linuxfoundation.org ([140.211.169.12]:54578 "EHLO mail.linuxfoundation.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1752514AbeCTJwS (ORCPT ); Tue, 20 Mar 2018 05:52:18 -0400 Received: from localhost (LFbn-1-12247-202.w90-92.abo.wanadoo.fr [90.92.61.202]) by mail.linuxfoundation.org (Postfix) with ESMTPSA id 6FB2A11EB; Tue, 20 Mar 2018 09:52:16 +0000 (UTC) Date: Tue, 20 Mar 2018 10:52:15 +0100 From: Greg Kroah-Hartman To: Dietmar Eggemann Cc: linux-kernel@vger.kernel.org, Peter Zijlstra , Quentin Perret , Thara Gopinath , linux-pm@vger.kernel.org, Morten Rasmussen , Chris Redpath , Patrick Bellasi , Valentin Schneider , "Rafael J . Wysocki" , Vincent Guittot , Viresh Kumar , Todd Kjos , Joel Fernandes Subject: Re: [RFC PATCH 2/6] sched: Introduce energy models of CPUs Message-ID: <20180320095215.GB23359@kroah.com> References: <20180320094312.24081-1-dietmar.eggemann@arm.com> <20180320094312.24081-3-dietmar.eggemann@arm.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20180320094312.24081-3-dietmar.eggemann@arm.com> User-Agent: Mutt/1.9.4 (2018-02-28) Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Tue, Mar 20, 2018 at 09:43:08AM +0000, Dietmar Eggemann wrote: > From: Quentin Perret > > The energy consumption of each CPU in the system is modeled with a list > of values representing its dissipated power and compute capacity at each > available Operating Performance Point (OPP). These values are derived > from existing information in the kernel (currently used by the thermal > subsystem) and don't require the introduction of new platform-specific > tunables. The energy model is also provided with a simple representation > of all frequency domains as cpumasks, hence enabling the scheduler to be > aware of dependencies between CPUs. The data required to build the energy > model is provided by the OPP library which enables an abstract view of > the platform from the scheduler. The new data structures holding these > models and the routines to populate them are stored in > kernel/sched/energy.c. > > For the sake of simplicity, it is assumed in the energy model that all > CPUs in a frequency domain share the same micro-architecture. As long as > this assumption is correct, the energy models of different CPUs belonging > to the same frequency domain are equal. Hence, this commit builds only one > energy model per frequency domain, and links all relevant CPUs to it in > order to save time and memory. If needed for future hardware platforms, > relaxing this assumption should imply relatively simple modifications in > the code but a significantly higher algorithmic complexity. > > As it appears that energy-aware scheduling really makes a difference on > heterogeneous systems (e.g. big.LITTLE platforms), it is restricted to > systems having: > > 1. SD_ASYM_CPUCAPACITY flag set > 2. Dynamic Voltage and Frequency Scaling (DVFS) is enabled > 3. Available power estimates for the OPPs of all possible CPUs > > Moreover, the scheduler is notified of the energy model availability > using a static key in order to minimize the overhead on non-energy-aware > systems. > > Cc: Ingo Molnar > Cc: Peter Zijlstra > Signed-off-by: Quentin Perret > Signed-off-by: Dietmar Eggemann > > --- > This patch depends on additional infrastructure being merged in the OPP > core. As this infrastructure can also be useful for other clients, the > related patches have been posted separately [1]. > > [1] https://marc.info/?l=linux-pm&m=151635516419249&w=2 > --- > include/linux/sched/energy.h | 31 +++++++ > kernel/sched/Makefile | 2 +- > kernel/sched/energy.c | 190 +++++++++++++++++++++++++++++++++++++++++++ > 3 files changed, 222 insertions(+), 1 deletion(-) > create mode 100644 include/linux/sched/energy.h > create mode 100644 kernel/sched/energy.c > > diff --git a/include/linux/sched/energy.h b/include/linux/sched/energy.h > new file mode 100644 > index 000000000000..b4f43564ffe4 > --- /dev/null > +++ b/include/linux/sched/energy.h > @@ -0,0 +1,31 @@ > +#ifndef _LINUX_SCHED_ENERGY_H > +#define _LINUX_SCHED_ENERGY_H No copyright or license info? Not good :( > --- /dev/null > +++ b/kernel/sched/energy.c > @@ -0,0 +1,190 @@ > +/* > + * Released under the GPLv2 only. > + * SPDX-License-Identifier: GPL-2.0 Please read the documentation for the SPDX lines on how to do them correctly. Newer versions of checkpatch.pl will catch this, but that is in linux-next for the moment. And once you have the SPDX line, the "Released under..." line is not needed. > + * > + * Energy-aware scheduling models > + * > + * Copyright (C) 2018, Arm Ltd. > + * Written by: Quentin Perret, Arm Ltd. > + * > + * This file is subject to the terms and conditions of the GNU General Public > + * License. See the file "COPYING" in the main directory of this archive > + * for more details. This paragraph is not needed at all. > + */ > + > +#define pr_fmt(fmt) "sched-energy: " fmt > + > +#include > +#include > +#include > + > +#include "sched.h" > + > +DEFINE_STATIC_KEY_FALSE(sched_energy_present); > +struct sched_energy_model ** __percpu energy_model; > + > +/* > + * A copy of the cpumasks representing the frequency domains is kept private > + * to the scheduler. They are stacked in a dynamically allocated linked list > + * as we don't know how many frequency domains the system has. > + */ > +LIST_HEAD(freq_domains); global variable? If so, please prefix it with something more unique than "freq_". > +#ifdef CONFIG_PM_OPP #ifdefs go in .h files, not .c files, right? thanks, greg k-h