Received: by 10.213.65.68 with SMTP id h4csp852640imn; Tue, 20 Mar 2018 17:46:41 -0700 (PDT) X-Google-Smtp-Source: AG47ELs4ZXRjJQmrcNacC/pwvzV03C6KsOuwaJe8pS/TSQSrWiNU5D26jsyE+mP/sXGfRRVLSQAs X-Received: by 10.98.196.153 with SMTP id h25mr7016698pfk.111.1521593201663; Tue, 20 Mar 2018 17:46:41 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1521593201; cv=none; d=google.com; s=arc-20160816; b=H1T6Ni0vcaDDUHTtCMstPDwf6GFR0w72dLScpRbsQOcgB+cGPijsS2lRlVfSDt3KM0 W3ekk8dDYHBou0W7RMU49MZ2A+svQMvz9Ql0F5iWt6f2Kmig9O+95n//O2T1rneDxn9f 58opsY55jQv0v6ZvZOZLSqHAp4lUGTfcX0Gg7mLdEo8mrt0Fk01+hF/tJuQd4ppxTZzE XJBxWldnjI3Inni4gWu3qxFetO9gKlUt2XAKouhDx0+WN1Fjj7iGymiE219FrwEbD0gP Eh3eb9dRnoBGiYLGDRGWs7AoxHRyiOp1E9PtQeovpsPDEHPxuTuCeMBjdNtgyaZijVwm t+eg== 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=ZsJbtR0Dok6b0TAsk1S7R/HVBjQ8H0geFmsfzFLSoRw=; b=KcFndDZAfO9PIAmiDNMSqFg8oF4o9U5NxZ2QsmOZdPxuHEAZiyfzED21n/+FF470HY NKqapQJTTgOBZ1Kzwg+EWGLzVzPCf5VRrYWta2zXO9TQRluV1FVhqza+UssvDiGcUCOL 8bXls/BD4ec7rUJkT4uTOngYoUuGezGQ7yvLfHQRSKyfhZxFv//eGVSKquzvUfCyoULO S/jFcDbo7CSn04nlK/iJ7D6Y7Q3IPXrAybh/Cyte7cRP9t2nNG1Koh73ouqdQEUy8HZ7 AgrZ281BKzrlVyTxGl+y973kK9hiHTeY6VnYaS7xg7mZFL/8aRQkBFtO/faRHMyd7jLV 4fZw== 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 d9si1888139pgo.687.2018.03.20.17.46.26; Tue, 20 Mar 2018 17:46: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 S1751514AbeCUApf (ORCPT + 99 others); Tue, 20 Mar 2018 20:45:35 -0400 Received: from usa-sjc-mx-foss1.foss.arm.com ([217.140.101.70]:47018 "EHLO foss.arm.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751018AbeCUApd (ORCPT ); Tue, 20 Mar 2018 20:45:33 -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 F17F91529; Tue, 20 Mar 2018 17:45:32 -0700 (PDT) Received: from queper01-VirtualBox (usa-sjc-mx-foss1.foss.arm.com [217.140.101.70]) by usa-sjc-imap-foss1.foss.arm.com (Postfix) with ESMTPSA id 5405B3F487; Tue, 20 Mar 2018 17:45:29 -0700 (PDT) Date: Wed, 21 Mar 2018 00:45:22 +0000 From: Quentin Perret To: Greg Kroah-Hartman Cc: Dietmar Eggemann , linux-kernel@vger.kernel.org, Peter Zijlstra , 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: <20180321004521.GA3174@queper01-VirtualBox> References: <20180320094312.24081-1-dietmar.eggemann@arm.com> <20180320094312.24081-3-dietmar.eggemann@arm.com> <20180320095215.GB23359@kroah.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20180320095215.GB23359@kroah.com> User-Agent: Mutt/1.9.2 (2017-12-15) Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Tuesday 20 Mar 2018 at 10:52:15 (+0100), Greg Kroah-Hartman wrote: > 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. Right, I will fix all the licence issues and add one to the new header file. I took example on existing files a while ago when I first wrote the patches and forgot to update them later on. Sorry about that. > > > + */ > > + > > +#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_". Will do. > > > +#ifdef CONFIG_PM_OPP > > #ifdefs go in .h files, not .c files, right? Yes good point. Actually, I might be able to tweak only kernel/sched/Makefile to ensure we have CONFIG_PM_OPP. I will look into it. > > thanks, > > greg k-h Thanks, Quentin