From: "tip-bot2 for Valentin Schneider" <tip-bot2@linutronix.de>
To: linux-tip-commits@vger.kernel.org
Cc: Valentin Schneider <valentin.schneider@arm.com>,
"Peter Zijlstra (Intel)" <peterz@infradead.org>,
x86 <x86@kernel.org>, LKML <linux-kernel@vger.kernel.org>
Subject: [tip: sched/core] arch_topology, sched/core: Cleanup thermal pressure definition
Date: Wed, 22 Jul 2020 09:12:24 -0000 [thread overview]
Message-ID: <159540914474.4006.8827205336223266532.tip-bot2@tip-bot2> (raw)
In-Reply-To: <20200712165917.9168-2-valentin.schneider@arm.com>
The following commit has been merged into the sched/core branch of tip:
Commit-ID: 25980c7a79af42f2daa73e2f475ebf4cbac8253e
Gitweb: https://git.kernel.org/tip/25980c7a79af42f2daa73e2f475ebf4cbac8253e
Author: Valentin Schneider <valentin.schneider@arm.com>
AuthorDate: Sun, 12 Jul 2020 17:59:15 +01:00
Committer: Peter Zijlstra <peterz@infradead.org>
CommitterDate: Wed, 22 Jul 2020 10:22:05 +02:00
arch_topology, sched/core: Cleanup thermal pressure definition
The following commit:
14533a16c46d ("thermal/cpu-cooling, sched/core: Move the arch_set_thermal_pressure() API to generic scheduler code")
moved the definition of arch_set_thermal_pressure() to sched/core.c, but
kept its declaration in linux/arch_topology.h. When building e.g. an x86
kernel with CONFIG_SCHED_THERMAL_PRESSURE=y, cpufreq_cooling.c ends up
getting the declaration of arch_set_thermal_pressure() from
include/linux/arch_topology.h, which is somewhat awkward.
On top of this, sched/core.c unconditionally defines
o The thermal_pressure percpu variable
o arch_set_thermal_pressure()
while arch_scale_thermal_pressure() does nothing unless redefined by the
architecture.
arch_*() functions are meant to be defined by architectures, so revert the
aforementioned commit and re-implement it in a way that keeps
arch_set_thermal_pressure() architecture-definable, and doesn't define the
thermal pressure percpu variable for kernels that don't need
it (CONFIG_SCHED_THERMAL_PRESSURE=n).
Signed-off-by: Valentin Schneider <valentin.schneider@arm.com>
Signed-off-by: Peter Zijlstra (Intel) <peterz@infradead.org>
Link: https://lkml.kernel.org/r/20200712165917.9168-2-valentin.schneider@arm.com
---
arch/arm/include/asm/topology.h | 3 ++-
arch/arm64/include/asm/topology.h | 3 ++-
drivers/base/arch_topology.c | 11 +++++++++++
include/linux/arch_topology.h | 4 ++--
include/linux/sched/topology.h | 7 +++++++
kernel/sched/core.c | 11 -----------
6 files changed, 24 insertions(+), 15 deletions(-)
diff --git a/arch/arm/include/asm/topology.h b/arch/arm/include/asm/topology.h
index 435aba2..e0593cf 100644
--- a/arch/arm/include/asm/topology.h
+++ b/arch/arm/include/asm/topology.h
@@ -16,8 +16,9 @@
/* Enable topology flag updates */
#define arch_update_cpu_topology topology_update_cpu_topology
-/* Replace task scheduler's default thermal pressure retrieve API */
+/* Replace task scheduler's default thermal pressure API */
#define arch_scale_thermal_pressure topology_get_thermal_pressure
+#define arch_set_thermal_pressure topology_set_thermal_pressure
#else
diff --git a/arch/arm64/include/asm/topology.h b/arch/arm64/include/asm/topology.h
index 0cc835d..e042f65 100644
--- a/arch/arm64/include/asm/topology.h
+++ b/arch/arm64/include/asm/topology.h
@@ -34,8 +34,9 @@ void topology_scale_freq_tick(void);
/* Enable topology flag updates */
#define arch_update_cpu_topology topology_update_cpu_topology
-/* Replace task scheduler's default thermal pressure retrieve API */
+/* Replace task scheduler's default thermal pressure API */
#define arch_scale_thermal_pressure topology_get_thermal_pressure
+#define arch_set_thermal_pressure topology_set_thermal_pressure
#include <asm-generic/topology.h>
diff --git a/drivers/base/arch_topology.c b/drivers/base/arch_topology.c
index 4d0a003..75f72d6 100644
--- a/drivers/base/arch_topology.c
+++ b/drivers/base/arch_topology.c
@@ -54,6 +54,17 @@ void topology_set_cpu_scale(unsigned int cpu, unsigned long capacity)
per_cpu(cpu_scale, cpu) = capacity;
}
+DEFINE_PER_CPU(unsigned long, thermal_pressure);
+
+void topology_set_thermal_pressure(const struct cpumask *cpus,
+ unsigned long th_pressure)
+{
+ int cpu;
+
+ for_each_cpu(cpu, cpus)
+ WRITE_ONCE(per_cpu(thermal_pressure, cpu), th_pressure);
+}
+
static ssize_t cpu_capacity_show(struct device *dev,
struct device_attribute *attr,
char *buf)
diff --git a/include/linux/arch_topology.h b/include/linux/arch_topology.h
index 0566cb3..69b1dab 100644
--- a/include/linux/arch_topology.h
+++ b/include/linux/arch_topology.h
@@ -39,8 +39,8 @@ static inline unsigned long topology_get_thermal_pressure(int cpu)
return per_cpu(thermal_pressure, cpu);
}
-void arch_set_thermal_pressure(struct cpumask *cpus,
- unsigned long th_pressure);
+void topology_set_thermal_pressure(const struct cpumask *cpus,
+ unsigned long th_pressure);
struct cpu_topology {
int thread_id;
diff --git a/include/linux/sched/topology.h b/include/linux/sched/topology.h
index fb11091..764222d 100644
--- a/include/linux/sched/topology.h
+++ b/include/linux/sched/topology.h
@@ -232,6 +232,13 @@ unsigned long arch_scale_thermal_pressure(int cpu)
}
#endif
+#ifndef arch_set_thermal_pressure
+static __always_inline
+void arch_set_thermal_pressure(const struct cpumask *cpus,
+ unsigned long th_pressure)
+{ }
+#endif
+
static inline int task_node(const struct task_struct *p)
{
return cpu_to_node(task_cpu(p));
diff --git a/kernel/sched/core.c b/kernel/sched/core.c
index 12db8fb..bd8e521 100644
--- a/kernel/sched/core.c
+++ b/kernel/sched/core.c
@@ -3869,17 +3869,6 @@ unsigned long long task_sched_runtime(struct task_struct *p)
return ns;
}
-DEFINE_PER_CPU(unsigned long, thermal_pressure);
-
-void arch_set_thermal_pressure(struct cpumask *cpus,
- unsigned long th_pressure)
-{
- int cpu;
-
- for_each_cpu(cpu, cpus)
- WRITE_ONCE(per_cpu(thermal_pressure, cpu), th_pressure);
-}
-
/*
* This function gets called by the timer code, with HZ frequency.
* We call it with interrupts disabled.
next prev parent reply other threads:[~2020-07-22 9:12 UTC|newest]
Thread overview: 18+ messages / expand[flat|nested] mbox.gz Atom feed top
2020-07-12 16:59 [PATCH v2 0/3] sched, arch_topology: Thermal pressure configuration cleanup Valentin Schneider
2020-07-12 16:59 ` [PATCH v2 1/3] arch_topology, sched/core: Cleanup thermal pressure definition Valentin Schneider
2020-07-13 14:32 ` Thara Gopinath
2020-07-22 9:12 ` tip-bot2 for Valentin Schneider [this message]
2020-07-12 16:59 ` [PATCH v2 2/3] sched: Cleanup SCHED_THERMAL_PRESSURE kconfig entry Valentin Schneider
2020-07-22 9:12 ` [tip: sched/core] " tip-bot2 for Valentin Schneider
2020-07-27 14:18 ` [PATCH v2 2/3] " Qian Cai
2020-07-27 17:45 ` Dietmar Eggemann
2020-07-28 16:16 ` Valentin Schneider
2020-07-29 8:07 ` Dietmar Eggemann
2020-07-29 13:09 ` Quentin Perret
2020-07-29 13:29 ` Valentin Schneider
2020-07-12 16:59 ` [PATCH v2 3/3] arm, arm64: Select CONFIG_SCHED_THERMAL_PRESSURE Valentin Schneider
2020-07-13 10:03 ` Catalin Marinas
2020-07-13 10:29 ` Valentin Schneider
2020-07-22 9:12 ` [tip: sched/core] " tip-bot2 for Valentin Schneider
2020-07-13 10:37 ` [PATCH v2 0/3] sched, arch_topology: Thermal pressure configuration cleanup Peter Zijlstra
2020-07-13 12:03 ` Vincent Guittot
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=159540914474.4006.8827205336223266532.tip-bot2@tip-bot2 \
--to=tip-bot2@linutronix.de \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-tip-commits@vger.kernel.org \
--cc=peterz@infradead.org \
--cc=valentin.schneider@arm.com \
--cc=x86@kernel.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox
all inboxes | Powered by JetHome®