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: 10632939 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id 49B5B112B for ; Tue, 9 Oct 2018 16:25:07 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 3CD8B28DCF for ; Tue, 9 Oct 2018 16:25:07 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 3075228F1C; Tue, 9 Oct 2018 16:25:07 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-8.0 required=2.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,MAILING_LIST_MULTI,RCVD_IN_DNSWL_HI autolearn=ham version=3.3.1 Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id B820F28DCF for ; Tue, 9 Oct 2018 16:25:06 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1726564AbeJIXms (ORCPT ); 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-Google-Smtp-Source: ACcGV62k1XIswLjjO5lfrt2ZzZpwkE7tQsZyeU76mI+rVocYrlcppRx8noff/9U1WlpOIqeWY7pZ2w== 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 X-Virus-Scanned: ClamAV using ClamSMTP 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