hc
2024-02-20 102a0743326a03cd1a1202ceda21e175b7d3575c
kernel/drivers/cpufreq/cpufreq_governor.c
....@@ -1,3 +1,4 @@
1
+// SPDX-License-Identifier: GPL-2.0-only
12 /*
23 * drivers/cpufreq/cpufreq_governor.c
34 *
....@@ -8,10 +9,6 @@
89 * (C) 2003 Jun Nakajima <jun.nakajima@intel.com>
910 * (C) 2009 Alexander Clouter <alex@digriz.org.uk>
1011 * (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.
1512 */
1613
1714 #define pr_fmt(fmt) KBUILD_MODNAME ": " fmt
....@@ -29,7 +26,7 @@
2926 static DEFINE_MUTEX(gov_dbs_data_mutex);
3027
3128 /* Common sysfs tunables */
32
-/**
29
+/*
3330 * store_sampling_rate - update sampling rate effective immediately if needed.
3431 *
3532 * If new rate is smaller than the old, simply updating
....@@ -108,7 +105,7 @@
108105 j_cdbs->prev_cpu_idle = get_cpu_idle_time(j, &j_cdbs->prev_update_time,
109106 dbs_data->io_is_busy);
110107 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);
112109 }
113110 }
114111 }
....@@ -152,7 +149,7 @@
152149 j_cdbs->prev_cpu_idle = cur_idle_time;
153150
154151 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);
156153
157154 idle_time += div_u64(cur_nice - j_cdbs->prev_cpu_nice, NSEC_PER_USEC);
158155 j_cdbs->prev_cpu_nice = cur_nice;
....@@ -346,7 +343,7 @@
346343 for_each_cpu(i, policy->cpus)
347344 cpufreq_remove_update_util_hook(i);
348345
349
- synchronize_sched();
346
+ synchronize_rcu();
350347 }
351348
352349 static struct policy_dbs_info *alloc_policy_dbs_info(struct cpufreq_policy *policy,
....@@ -533,7 +530,7 @@
533530 j_cdbs->prev_load = 0;
534531
535532 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);
537534 }
538535
539536 gov->start(policy);