From patchwork Tue Nov 24 06:26:13 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Viresh Kumar X-Patchwork-Id: 11927269 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-13.8 required=3.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,HEADER_FROM_DIFFERENT_DOMAINS,INCLUDES_PATCH, MAILING_LIST_MULTI,SPF_HELO_NONE,SPF_PASS,USER_AGENT_GIT autolearn=ham autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 2C13DC56201 for ; Tue, 24 Nov 2020 06:26:24 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id AF67E2085B for ; Tue, 24 Nov 2020 06:26:23 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=pass (2048-bit key) header.d=linaro.org header.i=@linaro.org header.b="Xv/A2ULC" Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1729684AbgKXG0X (ORCPT ); Tue, 24 Nov 2020 01:26:23 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:52760 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1729304AbgKXG0W (ORCPT ); Tue, 24 Nov 2020 01:26:22 -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 B1BFEC0613D6 for ; Mon, 23 Nov 2020 22:26:22 -0800 (PST) Received: by mail-pf1-x442.google.com with SMTP id n137so7437088pfd.3 for ; Mon, 23 Nov 2020 22:26:22 -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=jpZw9Iej76OYuUGFvM+oELcoTaKPmqjpkVWxqorKfuc=; b=Xv/A2ULC/Ok9WfCZGQKExT+MDpPlNLIiKoRnayVzlu5cJ9+f2QTMIQZh4TnuwxFzCj qMWHnMM37/b/MLGm0vSq7k9REQu9iRjh3AXlKd52WgXmjc8VgkMsdXvKStaqQ/4f9zCv IhqMvmnE9Ue1kqDasiSEqMkCNS0MwJSml2pKbD9Wx7cTAGKeUST2X/6HQ/cX2o5upzwe SKsSkeY3ag3dK/LgL33C3ubxgkLxNcpXmpIf3QClddFEcDLwPHSz6XolWRhUMJK3JboD 0AL3TrMPc74lGa7wRwncbdL1iltJFDxhaa3Q9Esi0OyDPdbeKXCfEGE/q5HQbjLjS54J ZrJg== 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=jpZw9Iej76OYuUGFvM+oELcoTaKPmqjpkVWxqorKfuc=; b=qtyoY1oorfCNgV94zEaiKyeSOeYdXodhZ1tGx77G7jISMHhIurohv+jhH6zcqpgi8j OYs/QBX/kHvwHAT++UveIzLMEScD29MKMR5BR/u9+tpKnaa7SYqh88UpT7Z96oVLk+Jh 1V7lcTNjXmqfzMjNA7hpP3vKZeIG6ORoXwzCs3VhtMDJwYMlgg5HHqBVaNlKuK1YYylN 0oR6KRxZQFUovldjXZUqqcig8J8xHPIGTRXNXUvQdrohdUptaZMBCXDKZkJDWMwhANG5 ZLSZD+f07tp5DFS0uZv/BV+jKAcqhxvTkq2dXhdL66Q0LCJGXTA9tsCFxk63GXIRk7yV cB9Q== X-Gm-Message-State: AOAM531pgDq073thtyRwBktvPQIlY0CG7iHxnZRrnPZ1341y1Wv1rOTv oEM+u58zJ3bZ3qOlLN31rRiWEQ== X-Google-Smtp-Source: ABdhPJzSE6Krloh3zuTDK0TQPefXqGY3SdvFhb05zcIkKe8FZifbiRpzKRKf1hWkLPX/0GznUt8NMA== X-Received: by 2002:a63:4765:: with SMTP id w37mr2537452pgk.332.1606199182233; Mon, 23 Nov 2020 22:26:22 -0800 (PST) Received: from localhost ([122.172.12.172]) by smtp.gmail.com with ESMTPSA id 67sm4436226pfz.96.2020.11.23.22.26.20 (version=TLS1_2 cipher=ECDHE-ECDSA-AES128-GCM-SHA256 bits=128/128); Mon, 23 Nov 2020 22:26:21 -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 Subject: [PATCH V4 0/3] cpufreq_cooling: Get effective CPU utilization from scheduler Date: Tue, 24 Nov 2020 11:56:13 +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 log of patch 2/2. 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 | 68 ++++++++++++++---- include/linux/sched.h | 21 ++++++ kernel/sched/core.c | 115 ++++++++++++++++++++++++++++++ kernel/sched/cpufreq_schedutil.c | 108 +--------------------------- kernel/sched/fair.c | 6 +- kernel/sched/sched.h | 31 +------- 6 files changed, 197 insertions(+), 152 deletions(-) base-commit: 3650b228f83adda7e5ee532e2b90429c03f7b9ec