From patchwork Tue Feb 20 14:59:42 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Vincent Guittot X-Patchwork-Id: 13564121 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from bombadil.infradead.org (bombadil.infradead.org [198.137.202.133]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.lore.kernel.org (Postfix) with ESMTPS id 1853AC48BC3 for ; Tue, 20 Feb 2024 15:00:17 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20210309; h=Sender: Content-Transfer-Encoding:Content-Type:List-Subscribe:List-Help:List-Post: List-Archive:List-Unsubscribe:List-Id:MIME-Version:Message-Id:Date:Subject:Cc :To:From:Reply-To:Content-ID:Content-Description:Resent-Date:Resent-From: Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID:In-Reply-To:References: List-Owner; bh=CVWzlnZADVoCBuz5PG58H8PeH2zOnC34SHrRyfcKjCs=; b=pEXA1EWLzuf11o vUBRb8FHVHke3KDXK0QJptFaR0/zojFi6QSAMeqbj/U+JZcWYiMnF1VZWKiJ8QC+lmP00kFonSvf8 AtT4QOQS/tuwr0Jsom50drDycRfq55pQn56360Gwh3SS6p9FcvvJwVonA8jqRIA9nCqLBItGADbgt Um0lknDQBOz0LyCFdokTKJ82H9Kq+Q849QpWX/K1TV5gWiIsW2bycXsYSVJ3JBinlIMQo164Sz2jY umiaYVNolLhBHkWMmCFBbsPfW2k7kqgExUJdVhTb9SccUNH6TMAvXbTSqNDqe0aBJKuk1OXXhJrcg ReTJuCgo427SWojXpM3w==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.97.1 #2 (Red Hat Linux)) id 1rcRbF-0000000FAVx-0n5h; Tue, 20 Feb 2024 15:00:01 +0000 Received: from mail-wm1-x332.google.com ([2a00:1450:4864:20::332]) by bombadil.infradead.org with esmtps (Exim 4.97.1 #2 (Red Hat Linux)) id 1rcRbA-0000000FAS6-32hY for linux-arm-kernel@lists.infradead.org; Tue, 20 Feb 2024 14:59:59 +0000 Received: by mail-wm1-x332.google.com with SMTP id 5b1f17b1804b1-412698ac6f9so10417495e9.0 for ; Tue, 20 Feb 2024 06:59:55 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1708441195; x=1709045995; darn=lists.infradead.org; h=content-transfer-encoding:mime-version:message-id:date:subject:cc :to:from:from:to:cc:subject:date:message-id:reply-to; bh=srxTKj/NUZFuJQko8D1JWG1zd/3QbRcjQ+DRmUNuvH0=; b=wXqpFR3d2LpSwmfuOg1FpEnwPeprio35oIMgG7GUYy03H0J1OXCDbzocYQ6RglGCbW NYphBNl+j1u7KaXAfeTHw519C8KSkI18tsxDy3z7DD6LnNlEpOXmkioJ7ZbhTswfXwpn s4fNQXoGZ22m+5AjDgdf6uMTCPfX07JAZtl5G2jkAp0mLz3AdV3J/IbTXeWTFUALLYvG yMLlgkBnPm3lBrxphJZ7bZheWLSUSOrQrEGdzzffekkxcMW8GtDKDaJSKOFg4EI8ZslP geOWAa1D5PE7OSzuw4ztD/7hMccHXc6WrevSU+10l5yRG/SBLj98DyZhM3hEvSOwhS1K vO5Q== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1708441195; x=1709045995; h=content-transfer-encoding:mime-version:message-id:date:subject:cc :to:from:x-gm-message-state:from:to:cc:subject:date:message-id :reply-to; bh=srxTKj/NUZFuJQko8D1JWG1zd/3QbRcjQ+DRmUNuvH0=; b=BemiMEdOrDJxLU3/ThQi3T6BJtKrZPkWaBMxrXNJty2kUxM3SIdDMyOeF4p7Ynlaxt +tobgBrHFuXKcMVvQ2CfEiOq4dfe9A1pWVoPWs67DOtdl9AtQd0N8l34ZfbvaubRD0BU xpTzlp5FdLC8R6jbdUQe/nm7s66xosYIprx1c/Jj+ebrRjqFP1mtao9U+A99cloJz2Sy hla/hVfUL9sd9qbBlWkvN1eSxWSXN6Q2037vv2eO2CMG5q+F8XR4lz91W5DCTEhJpdyE y2aENB7Iq6AswnytOcfVnbF/7QAThcIZrbWoCZTs1PRX0l2RgKJFT9SoQP0TTv5AcZjN V7lQ== X-Forwarded-Encrypted: i=1; AJvYcCVaK6IN0KponL6/BSQNcncJzkQNc3PqtTvKAlriK67ZMJnGR9fVN1wnVz115ThKSTJjraFrsdlKw8rjiHfoWLmKO2kxKNoGpkGR5RDW1NeS9grbwYY= X-Gm-Message-State: AOJu0YyXT/xWW78NtDMVy8LfsPN6/1tnTIK4laB/1z/tlLv5z/BjvhJ8 VH1iRGyJhhnEoGxOv7P4Wru0PGYZHnaaKZrDPsZliOqFnjkHwVhXspeCl40Utf8= X-Google-Smtp-Source: AGHT+IGoZ12/HJdh5JXOFNK3u7cPShEpcGd/MlU9rkqxFoq73RjSNBz88He/+s6YAv8PPsc7Ti7I7w== X-Received: by 2002:a05:600c:1d1a:b0:411:db41:687c with SMTP id l26-20020a05600c1d1a00b00411db41687cmr15174599wms.13.1708441194664; Tue, 20 Feb 2024 06:59:54 -0800 (PST) Received: from vingu-book.. ([2a01:e0a:f:6020:8deb:bfb9:b028:6d5c]) by smtp.gmail.com with ESMTPSA id v4-20020a5d6784000000b0033d39626c27sm9304405wru.76.2024.02.20.06.59.53 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 20 Feb 2024 06:59:53 -0800 (PST) From: Vincent Guittot To: linux@armlinux.org.uk, catalin.marinas@arm.com, will@kernel.org, sudeep.holla@arm.com, rafael@kernel.org, viresh.kumar@linaro.org, agross@kernel.org, andersson@kernel.org, konrad.dybcio@linaro.org, mingo@redhat.com, peterz@infradead.org, juri.lelli@redhat.com, dietmar.eggemann@arm.com, rostedt@goodmis.org, bsegall@google.com, mgorman@suse.de, bristot@redhat.com, vschneid@redhat.com, lukasz.luba@arm.com, rui.zhang@intel.com, mhiramat@kernel.org, daniel.lezcano@linaro.org, amit.kachhap@gmail.com, corbet@lwn.net, gregkh@linuxfoundation.org, linux-arm-kernel@lists.infradead.org, linux-kernel@vger.kernel.org, linux-pm@vger.kernel.org, linux-arm-msm@vger.kernel.org, linux-trace-kernel@vger.kernel.org, linux-doc@vger.kernel.org Cc: Vincent Guittot Subject: [PATCH v5 0/5] Rework system pressure interface to the scheduler Date: Tue, 20 Feb 2024 15:59:42 +0100 Message-Id: <20240220145947.1107937-1-vincent.guittot@linaro.org> X-Mailer: git-send-email 2.34.1 MIME-Version: 1.0 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20240220_065956_817436_9970E313 X-CRM114-Status: GOOD ( 14.87 ) X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+linux-arm-kernel=archiver.kernel.org@lists.infradead.org Following the consolidation and cleanup of CPU capacity in [1], this serie reworks how the scheduler gets the pressures on CPUs. We need to take into account all pressures applied by cpufreq on the compute capacity of a CPU for dozens of ms or more and not only cpufreq cooling device or HW mitigiations. We split the pressure applied on CPU's capacity in 2 parts: - one from cpufreq and freq_qos - one from HW high freq mitigiation. The next step will be to add a dedicated interface for long standing capping of the CPU capacity (i.e. for seconds or more) like the scaling_max_freq of cpufreq sysfs. The latter is already taken into account by this serie but as a temporary pressure which is not always the best choice when we know that it will happen for seconds or more. [1] https://lore.kernel.org/lkml/20231211104855.558096-1-vincent.guittot@linaro.org/ Change since v4: - Add READ_ONCE() in cpufreq_get_pressure() - Add ack and reviewed tags Change since v3: - Fix uninitialized variables in cpufreq_update_pressure() Change since v2: - Rework cpufreq_update_pressure() Change since v1: - Use struct cpufreq_policy as parameter of cpufreq_update_pressure() - Fix typos and comments - Make sched_thermal_decay_shift boot param as deprecated Vincent Guittot (5): cpufreq: Add a cpufreq pressure feedback for the scheduler sched: Take cpufreq feedback into account thermal/cpufreq: Remove arch_update_thermal_pressure() sched: Rename arch_update_thermal_pressure into arch_update_hw_pressure sched/pelt: Remove shift of thermal clock .../admin-guide/kernel-parameters.txt | 1 + arch/arm/include/asm/topology.h | 6 +- arch/arm64/include/asm/topology.h | 6 +- drivers/base/arch_topology.c | 26 ++++---- drivers/cpufreq/cpufreq.c | 36 +++++++++++ drivers/cpufreq/qcom-cpufreq-hw.c | 4 +- drivers/thermal/cpufreq_cooling.c | 3 - include/linux/arch_topology.h | 8 +-- include/linux/cpufreq.h | 10 +++ include/linux/sched/topology.h | 8 +-- .../{thermal_pressure.h => hw_pressure.h} | 14 ++--- include/trace/events/sched.h | 2 +- init/Kconfig | 12 ++-- kernel/sched/core.c | 8 +-- kernel/sched/fair.c | 63 +++++++++---------- kernel/sched/pelt.c | 18 +++--- kernel/sched/pelt.h | 16 ++--- kernel/sched/sched.h | 22 +------ 18 files changed, 144 insertions(+), 119 deletions(-) rename include/trace/events/{thermal_pressure.h => hw_pressure.h} (55%) Reviewed-by: Lukasz Luba Tested-by: Lukasz Luba