Skip to content

Commit

Permalink
thermal/cpu-cooling, sched/core: Move the arch_set_thermal_pressure()…
Browse files Browse the repository at this point in the history
… API to generic scheduler code

drivers/base/arch_topology.c is only built if CONFIG_GENERIC_ARCH_TOPOLOGY=y,
resulting in such build failures:

  cpufreq_cooling.c:(.text+0x1e7): undefined reference to `arch_set_thermal_pressure'

Move it to sched/core.c instead, and keep it enabled on x86 despite
us not having a arch_scale_thermal_pressure() facility there, to
build-test this thing.

Cc: Thara Gopinath <thara.gopinath@linaro.org>
Cc: Peter Zijlstra (Intel) <peterz@infradead.org>
Signed-off-by: Ingo Molnar <mingo@kernel.org>
  • Loading branch information
Ingo Molnar committed Mar 6, 2020
1 parent d94a9df commit 14533a1
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 11 deletions.
11 changes: 0 additions & 11 deletions drivers/base/arch_topology.c
Original file line number Diff line number Diff line change
Expand Up @@ -42,17 +42,6 @@ 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 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);
}

static ssize_t cpu_capacity_show(struct device *dev,
struct device_attribute *attr,
char *buf)
Expand Down
11 changes: 11 additions & 0 deletions kernel/sched/core.c
Original file line number Diff line number Diff line change
Expand Up @@ -3576,6 +3576,17 @@ 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.
Expand Down

0 comments on commit 14533a1

Please sign in to comment.