Hi all,
Today's linux-next merge of the tip tree got a conflict in:
drivers/cpufreq/cpufreq_governor.c
between commit:
24fc5870808de ("cpufreq: governor: Fix stale prev_cpu_nice spike when enabling ignore_nice_load")
from the pm tree and commit:
080b5c6d95034 ("sched/cputime: Remove superfluous and error prone kcpustat_field() parameter")
from the tip tree.
I fixed it up (see below) and can carry the fix as necessary. This
is now fixed as far as linux-next is concerned, but any non trivial
conflicts should be mentioned to your upstream maintainer when your tree
is submitted for merging. You may also want to consider cooperating
with the maintainer of the conflicting tree to minimise any particularly
complex conflicts.
diff --cc drivers/cpufreq/cpufreq_governor.c
index 8a85bd32defe7,3c4a1f9af3ae8..0000000000000
--- a/drivers/cpufreq/cpufreq_governor.c
+++ b/drivers/cpufreq/cpufreq_governor.c
@@@ -112,9 -104,9 +112,9 @@@ void gov_update_cpu_data(struct dbs_dat
j_cdbs->prev_cpu_idle = get_cpu_idle_time(j, &j_cdbs->prev_update_time,
dbs_data->io_is_busy);
- j_cdbs->prev_cpu_nice = kcpustat_field(&kcpustat_cpu(j), CPUTIME_NICE, j);
- if (dbs_data->ignore_nice_load)
- j_cdbs->prev_cpu_nice = kcpustat_field(CPUTIME_NICE, j);
++ j_cdbs->prev_cpu_nice = kcpustat_field(CPUTIME_NICE, j);
}
+ mutex_unlock(&policy_dbs->update_mutex);
}
}
EXPORT_SYMBOL_GPL(gov_update_cpu_data);
@@@ -173,18 -164,12 +173,18 @@@ unsigned int dbs_update(struct cpufreq_
j_cdbs->prev_cpu_idle = cur_idle_time;
- if (ignore_nice) {
- u64 cur_nice = kcpustat_field(CPUTIME_NICE, j);
-
+ /*
+ * Always sample cur_nice and advance prev_cpu_nice, regardless
+ * of ignore_nice. This keeps prev_cpu_nice current so that
+ * enabling ignore_nice_load via sysfs never produces a
+ * stale-baseline spike (the delta will be at most one sampling
+ * interval of accumulated nice time, not since boot).
+ */
- cur_nice = kcpustat_field(&kcpustat_cpu(j), CPUTIME_NICE, j);
++ cur_nice = kcpustat_field(CPUTIME_NICE, j);
+ if (ignore_nice)
idle_time += div_u64(cur_nice - j_cdbs->prev_cpu_nice, NSEC_PER_USEC);
- j_cdbs->prev_cpu_nice = cur_nice;
- }
+
+ j_cdbs->prev_cpu_nice = cur_nice;
if (unlikely(!time_elapsed)) {
/*
@@@ -552,9 -537,10 +552,9 @@@ int cpufreq_dbs_governor_start(struct c
* Make the first invocation of dbs_update() compute the load.
*/
j_cdbs->prev_load = 0;
- j_cdbs->prev_cpu_nice = kcpustat_field(&kcpustat_cpu(j), CPUTIME_NICE, j);
-
- if (ignore_nice)
- j_cdbs->prev_cpu_nice = kcpustat_field(CPUTIME_NICE, j);
++ j_cdbs->prev_cpu_nice = kcpustat_field(CPUTIME_NICE, j);
}
+ mutex_unlock(&policy_dbs->update_mutex);
gov->start(policy);
Le Wed, Jun 03, 2026 at 02:32:34PM +0100, Mark Brown a écrit :
> Hi all,
>
> Today's linux-next merge of the tip tree got a conflict in:
>
> drivers/cpufreq/cpufreq_governor.c
>
> between commit:
>
> 24fc5870808de ("cpufreq: governor: Fix stale prev_cpu_nice spike when enabling ignore_nice_load")
>
> from the pm tree and commit:
>
> 080b5c6d95034 ("sched/cputime: Remove superfluous and error prone kcpustat_field() parameter")
>
> from the tip tree.
>
> I fixed it up (see below) and can carry the fix as necessary. This
> is now fixed as far as linux-next is concerned, but any non trivial
> conflicts should be mentioned to your upstream maintainer when your tree
> is submitted for merging. You may also want to consider cooperating
> with the maintainer of the conflicting tree to minimise any particularly
> complex conflicts.
The resolution looks good, thanks!
--
Frederic Weisbecker
SUSE Labs
© 2016 - 2026 Red Hat, Inc.