From patchwork Tue Dec 8 04:16:54 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Viresh Kumar X-Patchwork-Id: 339689 Delivered-To: patch@linaro.org Received: by 2002:a02:85a7:0:0:0:0:0 with SMTP id d36csp3368009jai; Mon, 7 Dec 2020 20:18:47 -0800 (PST) X-Google-Smtp-Source: ABdhPJyYi7aDiRTiiMYP8ZyDArVhOVTznKAiIF8aKAhlXOCB7kOWRXON7Nm9oPPYlQ073eVF8zH5 X-Received: by 2002:a17:906:3e02:: with SMTP id k2mr22038035eji.92.1607401127780; Mon, 07 Dec 2020 20:18:47 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1607401127; cv=none; d=google.com; s=arc-20160816; b=zJVTj6UiUFFYzz+eb3Xx2S+RlUfWml8vcrFNXic60fr8JHrHy2YdEOSYHlAxHD4wV+ BJZXcea710JDRf4esEHW+o+Wzbv8Su2BzxG+9ag/PNJckjsI+vMBZoHsFgv7C7dMHn23 NrpVvA4u99yxw7+7GUnT2nMpdMst+YErMk6VCMFWlWfZaAnUfoFlt5elgb9p97FBsnb+ Ah2xcJvebp4My9P3acbwtuWlziy/CYjnBR+BXbtuC2v0Lusxki263nztzk/pA4gw0POD 90iZSXVNAUaIWTU/3HJpBRXHUVGydGizdhqvdwgWXuxUyRpm1UFpGPSGWWPzZoTx4oZs CLTw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :message-id:date:subject:cc:to:from:dkim-signature; bh=QHdvJA2HTSsKcq12ECvAFT6hATkrl/TFzJg0uMaRku0=; b=qlOuoVsQVhlnVZ+M+W7/OusEzM6nyWuXFoqQf+iUnOL6F1dNZ1PG+jfr2aRhQaaMcm tiRijs4M+ovAbJ3lCkEp54Cbzfi7RS6M4c/WDBtFMDD5fyuwT5w/rhpybMe++cAiOCqd 1WDLvBnLkCBesbnhKpEEwGYNCT0BSff6clTedFz6hv+Bz+uWFZ9CgReAQX+/cgMqRX03 W3RzyN4AIJ3OoI5goQJrgU806PrH49cFDvsQlEDfM1+u8T4uKZ4oWCMb3LB2GBrKQ5I6 CPYBhoQP6G3aI8vJU7FuEptou9QSKN27t0zUUepAEiOpZ00AKUS7KH4VY9qoYN2HprIY AIHg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=YKPk34UO; spf=pass (google.com: domain of linux-pm-owner@vger.kernel.org designates 23.128.96.18 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. [23.128.96.18]) by mx.google.com with ESMTP id pw18si4674329ejb.163.2020.12.07.20.18.47; Mon, 07 Dec 2020 20:18:47 -0800 (PST) Received-SPF: pass (google.com: domain of linux-pm-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=YKPk34UO; spf=pass (google.com: domain of linux-pm-owner@vger.kernel.org designates 23.128.96.18 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 S1726231AbgLHERo (ORCPT + 8 others); Mon, 7 Dec 2020 23:17:44 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:56100 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726221AbgLHERo (ORCPT ); Mon, 7 Dec 2020 23:17:44 -0500 Received: from mail-pf1-x442.google.com (mail-pf1-x442.google.com [IPv6:2607:f8b0:4864:20::442]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id E3076C061749 for ; Mon, 7 Dec 2020 20:17:03 -0800 (PST) Received: by mail-pf1-x442.google.com with SMTP id 131so12614348pfb.9 for ; Mon, 07 Dec 2020 20:17:03 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; h=from:to:cc:subject:date:message-id:mime-version :content-transfer-encoding; bh=QHdvJA2HTSsKcq12ECvAFT6hATkrl/TFzJg0uMaRku0=; b=YKPk34UO6uwnipQNlIBKtdQw/9xGkncAFiZryxzvH34O/VEGjEaYwyr3zstJRQ23yy 2d6nIPyAZaPz21F5m+W7/O9qXIU0UQjDz2ncZzh2LBOlfEHAKFTGEVYcOnI+a7Zxd7ax dbsoZwoatQouMGQaIftlSidpryFdaeILezrvQeIjFP8uIdffKQJKbpbIURf3dHOM0MtH 0RyLIMvZkHvvRLFth5i+QTQbJPkxe8zkdskTn6ptpRb7DjXH/VJq0vsbf+bNOsM1qP2M Fn8f968ZMyDnvZ/3Itqt4GKht5ji6dSFw/F4MNLEGV+E7bIybyrDipAGSf26A4Kcq5ph g5QQ== 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:mime-version :content-transfer-encoding; bh=QHdvJA2HTSsKcq12ECvAFT6hATkrl/TFzJg0uMaRku0=; b=aNZh4AA383WpoKEURcp/SFlcJ0U0P7GeReyi/OZKaxfPqfuyPxgn0qRyh+to05G+YL e2m20C3TE99X2i6i3XyLwt9GJGlAGRUhC2Dn2DUeG3Dj006PtmATroIdKCY8rlGX19ij WjvTQEVtwM3pu9A4M8Ai1yHJ0F5sItWce0AvmuYXUI6JpNCyE3HxuvRZb/occucmvgy2 8XQbqL/MUqDAm80uaoF5cFYZtfg6JcWrgXNRiEqKRNuT4EFdjB9f+wuSTTBej0cxXBiF r2WWXJ7dmlR6s6gBWAhmk7Uz2AXzcBMCfUbbuX9GKQjvtyCmWYe+T/KIpZSPI+bMKCnT GTVg== X-Gm-Message-State: AOAM531E7xaxQ/xTBJUv0MJljX0TVeft8FWTwhsDOeMlJcqCzB5HZOw0 n5NB9LKicrgQbZb4t8NF9HO/2A== X-Received: by 2002:aa7:9afb:0:b029:19e:45d8:b102 with SMTP id y27-20020aa79afb0000b029019e45d8b102mr3130288pfp.48.1607401023135; Mon, 07 Dec 2020 20:17:03 -0800 (PST) Received: from localhost ([122.172.136.109]) by smtp.gmail.com with ESMTPSA id w9sm13052748pfj.128.2020.12.07.20.17.01 (version=TLS1_2 cipher=ECDHE-ECDSA-AES128-GCM-SHA256 bits=128/128); Mon, 07 Dec 2020 20:17:02 -0800 (PST) From: Viresh Kumar To: Ingo Molnar , Peter Zijlstra , Vincent Guittot , Amit Daniel Kachhap , Amit Kucheria , Ben Segall , Daniel Bristot de Oliveira , Daniel Lezcano , Dietmar Eggemann , Javi Merino , Juri Lelli , Mel Gorman , "Rafael J. Wysocki" , Steven Rostedt , Viresh Kumar , Zhang Rui Cc: linux-kernel@vger.kernel.org, Quentin Perret , Lukasz Luba , linux-pm@vger.kernel.org, "Rafael J. Wysocki" Subject: [PATCH V5 0/3] cpufreq_cooling: Get effective CPU utilization from scheduler Date: Tue, 8 Dec 2020 09:46:54 +0530 Message-Id: X-Mailer: git-send-email 2.25.0.rc1.19.g042ed3e048af MIME-Version: 1.0 Precedence: bulk List-ID: X-Mailing-List: linux-pm@vger.kernel.org Hi, This patchset makes the cpufreq_cooling driver reuse the CPU utilization metric provided by the scheduler instead of depending on idle and busy times of a CPU, which aren't that accurate to measure the busyness of a CPU for the next cycle. More details can be seen in the commit logs of the patches. V4->V5: - Don't export enum cpu_util_type and don't pass it as argument to sched_cpu_util(). - Fixed a build issue with !CONFIG_THERMAL_GOV_POWER_ALLOCATOR by moving {allocate|free}_idle_time() out of CONFIG_THERMAL_GOV_POWER_ALLOCATOR in patch 3/3. - Applied Acks from Rafael. V3->V4: - Broke the first patch into two parts and used effective_cpu_util() in schedutil (Rafael). - Removed comment about idle-injection in last patch based on feedback from Lukasz and added hi Reviewed-by tag. V2->V3: - Put the scheduler helpers within ifdef CONFIG_SMP. - Keep both SMP and !SMP implementations in the cpufreq_cooling driver. - Improved commit log with testing related information. -- Viresh Viresh Kumar (3): sched/core: Move schedutil_cpu_util() to core.c sched/core: Rename schedutil_cpu_util() and allow rest of the kernel to use it thermal: cpufreq_cooling: Reuse sched_cpu_util() for SMP platforms drivers/thermal/cpufreq_cooling.c | 69 ++++++++++++++---- include/linux/sched.h | 5 ++ kernel/sched/core.c | 114 ++++++++++++++++++++++++++++++ kernel/sched/cpufreq_schedutil.c | 108 +--------------------------- kernel/sched/fair.c | 6 +- kernel/sched/sched.h | 22 ++---- 6 files changed, 184 insertions(+), 140 deletions(-) base-commit: 3650b228f83adda7e5ee532e2b90429c03f7b9ec -- 2.25.0.rc1.19.g042ed3e048af