From patchwork Tue Mar 26 09:16:11 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Vincent Guittot X-Patchwork-Id: 13603713 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 80D70CD11DB for ; Tue, 26 Mar 2024 09:16:45 +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=BlAdMMjBa0m8gglc2VMX4xwfpXGL8++M/l1KNTSscxs=; b=laco8M5ATcZLu0 hEcQ54QC/F6LAPotT5YHjhqnFEsz1fottqFds9OAgL61G4TdVZZ8TEzpeKUJFZ5wq2Kw+ZEHVSGuq wtqPyUR2HLIABy3Y0cWW5f7FXruay7YKICbOTqEoVvhyzUjpKCskC00+tmS1s4mhIFHdMOUgvKFTZ 3e2oWIQ6g0nDuroqResUYSOT42GvshqpRRRtox6br6U4Xv/rlt/LhJc/gNoPtFuukUNH+08yPHZTB i8oyn3b9m38ZiPbUh/5KYbPAcIH4W3S5G8kHIT8yPSpUgBR29QbJvQJVfCaTgKbYzOmiuSQ4NLqb/ BKCf0/+iwM4PsVXM7T9Q==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.97.1 #2 (Red Hat Linux)) id 1rp2uz-00000003lfI-0ZMX; Tue, 26 Mar 2024 09:16:29 +0000 Received: from mail-wr1-x435.google.com ([2a00:1450:4864:20::435]) by bombadil.infradead.org with esmtps (Exim 4.97.1 #2 (Red Hat Linux)) id 1rp2ut-00000003lbt-3RHN for linux-arm-kernel@lists.infradead.org; Tue, 26 Mar 2024 09:16:25 +0000 Received: by mail-wr1-x435.google.com with SMTP id ffacd0b85a97d-341808b6217so3327788f8f.3 for ; Tue, 26 Mar 2024 02:16:22 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1711444580; x=1712049380; 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=QcCk2kfNGvdaBITkM75nEhX5qGXp7x44gB568VCUt38=; b=c46GFlSmCB5HmIhESVLpt3NtH+dob0fBmn49cvojCAI70de36cbLsz/CNzHNHRONhB Fmm/MSeR8SGTd1Jxv+geKXxvuGZxYiCI+VrArGcFMYe+Wsf8qtvE8fzAcHEbZtXhl6qo gc02iFDL3euzt9MmHYBVNhA0uRqNl0as2fk5H2hOuLQgeTPf2Zkyx2PtgpofcToOTpHD uLkWhNy/vVWQwkBomCQKYHZFBzY9ziSkHDLsOh1aTAMDoq9eQHDCsQrdk/DsQJk6etbJ TQoLTc6XA0eWULFgrKA4ut2CwdXmWm7d9wuVOFVBcOZPXyX1GFNHo9v3HQzeq1Ffbiz4 gtVw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1711444580; x=1712049380; 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=QcCk2kfNGvdaBITkM75nEhX5qGXp7x44gB568VCUt38=; b=MjggzaOs8P4zSTU4kbOZN4ap50332E8ySzCnH0rJLh3kcrSYop3Jjzob9LiRKewJeY NEJamupR+81ksD/9hN0JQN1DkOzJPyWOejV3ajdGQwLaMx2eYjTkh6VQpsp3lYbccJbl nPE6nzjH2+f0vT+/u7ZD41OL+r+QgoZGAp79iGHO/DxQi3BjbDXipSD5E8zuv0v4x979 kE/PEp0FBGtpIq3H/sX5RGZFugBEtIA4lLiBteiONUlIyRYZrAE9cYF38W7DB+ktqQeC ZoLqnJN6fAOewYgXIez09GnI53FXc1gPzIqgD7hd84wcEP33izrWa2XkmSlUjdyajx57 OdvQ== X-Forwarded-Encrypted: i=1; AJvYcCUwYIPd7oZfT5WaMlCREtWsDYjBZfSrDuy3fNH8pg8d9DFAmqtsuVKxrHZpDKzPPl6Vmi1wFf371Pq4f/vQlDy82po7odGznT7OVnWgd0Wazleegpo= X-Gm-Message-State: AOJu0Yx5DIALR/DycdLZpVbrkHt85UffOGFWSRtPY4T+uZsOIC65cgdS qBgvRiBL590uTpm9xa/9fCO+wbLN2QsBjieFzSMNk+n4Mm84FwOL1JYHLUsg/EE= X-Google-Smtp-Source: AGHT+IHPIOfByqNHi3u6ysUFuyRgD6rr0wqWolqBcmXXpi2X6rqRrQrQay0Z+FRtQsOrVs94hogLgg== X-Received: by 2002:adf:f3c9:0:b0:33e:7f51:c2fa with SMTP id g9-20020adff3c9000000b0033e7f51c2famr6482511wrp.47.1711444580402; Tue, 26 Mar 2024 02:16:20 -0700 (PDT) Received: from localhost.localdomain ([2a01:e0a:f:6020:e6b6:c92e:43ff:71d7]) by smtp.gmail.com with ESMTPSA id m15-20020adffe4f000000b0033e5c54d0d9sm11647606wrs.38.2024.03.26.02.16.19 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 26 Mar 2024 02:16:19 -0700 (PDT) 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 v6 0/5] Rework system pressure interface to the scheduler Date: Tue, 26 Mar 2024 10:16:11 +0100 Message-Id: <20240326091616.3696851-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-20240326_021623_899037_9718833A X-CRM114-Status: GOOD ( 15.43 ) 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 v5: - Rebase to fix a conflict in include/linux/cpufreq.h - Add few more tested and reviewed tags 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%)