diff options
author | Linus Walleij <linus.walleij@linaro.org> | 2020-01-17 08:59:29 +0100 |
---|---|---|
committer | Linus Walleij <linus.walleij@linaro.org> | 2020-01-17 08:59:29 +0100 |
commit | 6a77de2596a8d02cbfe9cebe448d8575e4354c9a (patch) | |
tree | 13e7621c147ef1415195213089ce3c2c94590bde /kernel/sched/cpufreq.c | |
parent | 59c324683400b41caa6d85b091e812ee3d5415c3 (diff) | |
parent | b3a987b0264d3ddbb24293ebff10eddfc472f653 (diff) | |
download | linux-6a77de2596a8d02cbfe9cebe448d8575e4354c9a.tar.gz linux-6a77de2596a8d02cbfe9cebe448d8575e4354c9a.tar.bz2 linux-6a77de2596a8d02cbfe9cebe448d8575e4354c9a.zip |
Merge tag 'v5.5-rc6' into devel
Linux 5.5-rc6
Diffstat (limited to 'kernel/sched/cpufreq.c')
-rw-r--r-- | kernel/sched/cpufreq.c | 18 |
1 files changed, 18 insertions, 0 deletions
diff --git a/kernel/sched/cpufreq.c b/kernel/sched/cpufreq.c index b5dcd1d83c7f..7c2fe50fd76d 100644 --- a/kernel/sched/cpufreq.c +++ b/kernel/sched/cpufreq.c @@ -5,6 +5,8 @@ * Copyright (C) 2016, Intel Corporation * Author: Rafael J. Wysocki <rafael.j.wysocki@intel.com> */ +#include <linux/cpufreq.h> + #include "sched.h" DEFINE_PER_CPU(struct update_util_data __rcu *, cpufreq_update_util_data); @@ -57,3 +59,19 @@ void cpufreq_remove_update_util_hook(int cpu) rcu_assign_pointer(per_cpu(cpufreq_update_util_data, cpu), NULL); } EXPORT_SYMBOL_GPL(cpufreq_remove_update_util_hook); + +/** + * cpufreq_this_cpu_can_update - Check if cpufreq policy can be updated. + * @policy: cpufreq policy to check. + * + * Return 'true' if: + * - the local and remote CPUs share @policy, + * - dvfs_possible_from_any_cpu is set in @policy and the local CPU is not going + * offline (in which case it is not expected to run cpufreq updates any more). + */ +bool cpufreq_this_cpu_can_update(struct cpufreq_policy *policy) +{ + return cpumask_test_cpu(smp_processor_id(), policy->cpus) || + (policy->dvfs_possible_from_any_cpu && + rcu_dereference_sched(*this_cpu_ptr(&cpufreq_update_util_data))); +} |