From patchwork Tue Oct 9 16:24:55 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Thara Gopinath X-Patchwork-Id: 148509 Delivered-To: patch@linaro.org Received: by 2002:a2e:8595:0:0:0:0:0 with SMTP id b21-v6csp5109495lji; Tue, 9 Oct 2018 09:25:07 -0700 (PDT) X-Google-Smtp-Source: ACcGV63Bv6mUUTblasCdUG1kOOgWzE77j0uOIWL9AQP978Dcv+Rgt41CX6Mrqusm6SkiClW3w4lx X-Received: by 2002:a62:5d89:: with SMTP id n9-v6mr31471769pfj.54.1539102306967; Tue, 09 Oct 2018 09:25:06 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1539102306; cv=none; d=google.com; s=arc-20160816; b=h6EMQ72OwFLSlFk25wLUKV5R+b1ZZNY0jcEToNQ90BkxsPCqtvKktYdg/mC/Iw0QJo 0M2TbQdXhE+x/uVHLchuSZe2BtLZvRO22O9tuHmtnQNCbgYN0gCLjgYse9sG5gR4WiGJ MZNwqLsnv6hpefTe3v44C4WHsNImfcBjRcX4SNz584LjtIyhGREimOfbHK+quHpRTKbJ a8NDTzWcsgNGIG9offhzRWgryiVpBZvuGWh5P7tbrL3SanUS83w044JHdRuECAjc2o7U EkzjtkGZZGkRb3QIGQi9woIDJIE6oy7Lo0/tUFHUCnTCWjXVncdwmHJFwo1YfcA2OT/C SAeA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:message-id:date:subject:cc:to:from :dkim-signature; bh=dEbuJPg+sN0ZPa1pEhH5wuA0UPKQdzy17mOB6bYyGbg=; b=qRhoRQIQxh9TJjRbdZXS6J5oyl6R4Fg33rvLX2Rup1oVEI/gX8nF3f5Dao24HsB/s5 dgtlzZntad2ZkPs63wut2lwqDicB2IiJuYkXP+TXJY0a0+It78CsTyiewjx5oG+v548x jedK6gpSQ+5sP6aERQr2+BTtiwabOuNDFh/Kw1kHLpuObYDDyLScAWaPcd7mahBRvnhU YjIEvBplPGNT1o3MPo/Lga4/xTMQRMP+sr6nQoPsf22825XFiFs+SmcEvejCWXdpUsZ5 B4MhEEi5hspzhN2Olw7Xfzq5OCkbkhDWetav37xA9UVFGFzeP9VREdvvd9sOLPVLVZy8 2eKQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=daiUVhzb; spf=pass (google.com: best guess record for domain of linux-pm-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-pm-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id u1-v6si20812241pgh.244.2018.10.09.09.25.06; Tue, 09 Oct 2018 09:25:06 -0700 (PDT) Received-SPF: pass (google.com: best guess record for domain of linux-pm-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=@linaro.org header.s=google header.b=daiUVhzb; spf=pass (google.com: best guess record for domain of linux-pm-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-pm-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1726564AbeJIXms (ORCPT + 10 others); Tue, 9 Oct 2018 19:42:48 -0400 Received: from mail-qk1-f196.google.com ([209.85.222.196]:34508 "EHLO mail-qk1-f196.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726476AbeJIXms (ORCPT ); Tue, 9 Oct 2018 19:42:48 -0400 Received: by mail-qk1-f196.google.com with SMTP id p6-v6so1323040qkg.1 for ; Tue, 09 Oct 2018 09:25:05 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; h=from:to:cc:subject:date:message-id; bh=dEbuJPg+sN0ZPa1pEhH5wuA0UPKQdzy17mOB6bYyGbg=; b=daiUVhzbL59m4RASOtUiAn3akoxuVjVtj/XuovByPLhG8hj903rY+ER2Bmkgm5LJXf t73QZ9Str5bVbSodIRVr0m1x5Y1MQbLwXhi4MIf+p9KRSPj12vaHDJgvDY0epj38IBh8 IWnBamNbhNvEmSLaKfc/OcwQC2+qyGFZjhmWQ= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id; bh=dEbuJPg+sN0ZPa1pEhH5wuA0UPKQdzy17mOB6bYyGbg=; b=iyOeoTugL4CjJYlqaCqOm6aJbHf/e+o/PeQMLgrrZHwpj46Df9ptLABgR2nHVPFGQb dra6/AvzfnqILXX8toxg9bnSOD5j7fUjXkfQyIgHZd1qCLBd7OQcKhnhtqjW5b8diUm4 dvGVtREDrFxm216XNqEmda31TCElZlb3VqLeUqzoEgNEq79fTuzYRYG0Ra74JCVw+pO/ FvLZ4Bk/VtkTB1IiyTuYcqk2VNV6n+9AH2ZdiDp2Ism6GLteulEz4A3baNE2LgQNu2N8 7b+94avENWIcJ0/NVs8P9CLkQJ+pH0k5BnHzLS41/1cHoaRZCTR8Ntf5oFVNIus+3Rlz BskA== X-Gm-Message-State: ABuFfog8FODYt82t+VHxUNiSvo2BuSjzhwTUVC93amdojRzwZiL8aVfc x2tAmZqZSf621tW7qkuFZmEr5Q== X-Received: by 2002:a37:27d0:: with SMTP id n199-v6mr22300447qkn.33.1539102304914; Tue, 09 Oct 2018 09:25:04 -0700 (PDT) Received: from Thara-Work-Ubuntu.fios-router.home (pool-71-255-245-97.washdc.fios.verizon.net. [71.255.245.97]) by smtp.googlemail.com with ESMTPSA id o7-v6sm10441169qkc.67.2018.10.09.09.25.03 (version=TLS1_2 cipher=ECDHE-RSA-AES128-SHA bits=128/128); Tue, 09 Oct 2018 09:25:03 -0700 (PDT) From: Thara Gopinath To: linux-kernel@vger.kernel.org, mingo@redhat.com, peterz@infradead.org, rui.zhang@intel.com Cc: gregkh@linuxfoundation.org, rafael@kernel.org, amit.kachhap@gmail.com, viresh.kumar@linaro.org, javi.merino@kernel.org, edubezval@gmail.com, daniel.lezcano@linaro.org, linux-pm@vger.kernel.org, quentin.perret@arm.com, ionela.voinescu@arm.com, vincent.guittot@linaro.org Subject: [RFC PATCH 0/7] Introduce thermal pressure Date: Tue, 9 Oct 2018 12:24:55 -0400 Message-Id: <1539102302-9057-1-git-send-email-thara.gopinath@linaro.org> X-Mailer: git-send-email 2.1.4 Sender: linux-pm-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-pm@vger.kernel.org Thermal governors can respond to an overheat event for a cpu by capping the cpu's maximum possible frequency. This in turn means that the maximum available compute capacity of the cpu is restricted. But today in linux kernel, in event of maximum frequency capping of a cpu, the maximum available compute capacity of the cpu is not adjusted at all. In other words, scheduler is unware maximum cpu capacity restrictions placed due to thermal activity. This patch series attempts to address this issue. The benefits identified are better task placement among available cpus in event of overheating which in turn leads to better performance numbers. The delta between the maximum possible capacity of a cpu and maximum available capacity of a cpu due to thermal event can be considered as thermal pressure. Instantaneous thermal pressure is hard to record and can sometime be erroneous as there can be mismatch between the actual capping of capacity and scheduler recording it. Thus solution is to have a weighted average per cpu value for thermal pressure over time. The weight reflects the amount of time the cpu has spent at a capped maximum frequency. To accumulate, average and appropriately decay thermal pressure, this patch series uses pelt signals and reuses the available framework that does a similar bookkeeping of rt/dl task utilization. Regarding testing, basic build, boot and sanity testing have been performed on hikey960 mainline kernel with debian file system. Further aobench (An occlusion renderer for benchmarking realworld floating point performance) showed the following results on hikey960 with debain. Result Standard Standard (Time secs) Error Deviation Hikey 960 - no thermal pressure applied 138.67 6.52 11.52% Hikey 960 - thermal pressure applied 122.37 5.78 11.57% Thara Gopinath (7): sched/pelt: Add option to make load and util calculations frequency invariant sched/pelt.c: Add support to track thermal pressure sched: Add infrastructure to store and update instantaneous thermal pressure sched: Initialize per cpu thermal pressure structure sched/fair: Enable CFS periodic tick to update thermal pressure sched/fair: update cpu_capcity to reflect thermal pressure thermal/cpu-cooling: Update thermal pressure in case of a maximum frequency capping drivers/base/arch_topology.c | 1 + drivers/thermal/cpu_cooling.c | 20 ++++++++++++- include/linux/sched.h | 14 +++++++++ kernel/sched/Makefile | 2 +- kernel/sched/core.c | 2 ++ kernel/sched/fair.c | 4 +++ kernel/sched/pelt.c | 40 ++++++++++++++++++-------- kernel/sched/pelt.h | 7 +++++ kernel/sched/sched.h | 1 + kernel/sched/thermal.c | 66 +++++++++++++++++++++++++++++++++++++++++++ kernel/sched/thermal.h | 13 +++++++++ 11 files changed, 157 insertions(+), 13 deletions(-) create mode 100644 kernel/sched/thermal.c create mode 100644 kernel/sched/thermal.h -- 2.1.4