| .. | .. |
|---|
| 1 | +// SPDX-License-Identifier: GPL-2.0-only |
|---|
| 1 | 2 | /* |
|---|
| 2 | 3 | * drivers/cpufreq/cpufreq_governor.c |
|---|
| 3 | 4 | * |
|---|
| .. | .. |
|---|
| 8 | 9 | * (C) 2003 Jun Nakajima <jun.nakajima@intel.com> |
|---|
| 9 | 10 | * (C) 2009 Alexander Clouter <alex@digriz.org.uk> |
|---|
| 10 | 11 | * (c) 2012 Viresh Kumar <viresh.kumar@linaro.org> |
|---|
| 11 | | - * |
|---|
| 12 | | - * This program is free software; you can redistribute it and/or modify |
|---|
| 13 | | - * it under the terms of the GNU General Public License version 2 as |
|---|
| 14 | | - * published by the Free Software Foundation. |
|---|
| 15 | 12 | */ |
|---|
| 16 | 13 | |
|---|
| 17 | 14 | #define pr_fmt(fmt) KBUILD_MODNAME ": " fmt |
|---|
| .. | .. |
|---|
| 29 | 26 | static DEFINE_MUTEX(gov_dbs_data_mutex); |
|---|
| 30 | 27 | |
|---|
| 31 | 28 | /* Common sysfs tunables */ |
|---|
| 32 | | -/** |
|---|
| 29 | +/* |
|---|
| 33 | 30 | * store_sampling_rate - update sampling rate effective immediately if needed. |
|---|
| 34 | 31 | * |
|---|
| 35 | 32 | * If new rate is smaller than the old, simply updating |
|---|
| .. | .. |
|---|
| 108 | 105 | j_cdbs->prev_cpu_idle = get_cpu_idle_time(j, &j_cdbs->prev_update_time, |
|---|
| 109 | 106 | dbs_data->io_is_busy); |
|---|
| 110 | 107 | if (dbs_data->ignore_nice_load) |
|---|
| 111 | | - j_cdbs->prev_cpu_nice = kcpustat_cpu(j).cpustat[CPUTIME_NICE]; |
|---|
| 108 | + j_cdbs->prev_cpu_nice = kcpustat_field(&kcpustat_cpu(j), CPUTIME_NICE, j); |
|---|
| 112 | 109 | } |
|---|
| 113 | 110 | } |
|---|
| 114 | 111 | } |
|---|
| .. | .. |
|---|
| 152 | 149 | j_cdbs->prev_cpu_idle = cur_idle_time; |
|---|
| 153 | 150 | |
|---|
| 154 | 151 | if (ignore_nice) { |
|---|
| 155 | | - u64 cur_nice = kcpustat_cpu(j).cpustat[CPUTIME_NICE]; |
|---|
| 152 | + u64 cur_nice = kcpustat_field(&kcpustat_cpu(j), CPUTIME_NICE, j); |
|---|
| 156 | 153 | |
|---|
| 157 | 154 | idle_time += div_u64(cur_nice - j_cdbs->prev_cpu_nice, NSEC_PER_USEC); |
|---|
| 158 | 155 | j_cdbs->prev_cpu_nice = cur_nice; |
|---|
| .. | .. |
|---|
| 346 | 343 | for_each_cpu(i, policy->cpus) |
|---|
| 347 | 344 | cpufreq_remove_update_util_hook(i); |
|---|
| 348 | 345 | |
|---|
| 349 | | - synchronize_sched(); |
|---|
| 346 | + synchronize_rcu(); |
|---|
| 350 | 347 | } |
|---|
| 351 | 348 | |
|---|
| 352 | 349 | static struct policy_dbs_info *alloc_policy_dbs_info(struct cpufreq_policy *policy, |
|---|
| .. | .. |
|---|
| 533 | 530 | j_cdbs->prev_load = 0; |
|---|
| 534 | 531 | |
|---|
| 535 | 532 | if (ignore_nice) |
|---|
| 536 | | - j_cdbs->prev_cpu_nice = kcpustat_cpu(j).cpustat[CPUTIME_NICE]; |
|---|
| 533 | + j_cdbs->prev_cpu_nice = kcpustat_field(&kcpustat_cpu(j), CPUTIME_NICE, j); |
|---|
| 537 | 534 | } |
|---|
| 538 | 535 | |
|---|
| 539 | 536 | gov->start(policy); |
|---|