linux/kernel/sched
Linus Torvalds 3b4128b9f3 Timers and timekeeping core updates:
- Fix a subtly inconsistency in the timekeeping code, which fails to
     account for the monotonicity adjustment in ntp_error. For small changes
     of the clocksource multiplicator (+/-1) which are typically used by the
     NTP PLL this is hardly to observe. But for larger adjustments,
     e.g. caused by a direct frequency setting through adjtimex() the
     one-time uncompensated offset is significant.
 
     Cure this by adjusting ntp_error with the resulting offset so that the
     discrepancy is smoothed away over time
 
   - Make tick length calculations correct in NTP. The timekeeping core
     takes the quantisation of the clocksource into account when calculating
     the tick length to compensate for the deviation of the nominal
     NTP_INTERVAL_LENGTH. While timekeeping gets this right, NTP is not
     aware of that, which means it operates on the nominal value and not on
     the actual value which is determined by the clock source frequency. The
     rounding of a coarse clocksource like the ACPI PM timer results in a
     +127 PPM deviation.
 
     Cure this by exposing the deviation to the NTP code so that it can
     operate on the same data as the timekeeping core. This is purely kernel
     internal. User space still sees the nominal tick lenght via adjtimex().
 
   - The accuracy of the NTP adjustments is fairly approximate as the code
     assumes that the invocations are precisely in NTP interval frequency
     ticks and the final adjustment can over and under-run.
 
     Cure this by adjusting ntp_error by the intended skew on each tick to
     achieve the desired rate.
 
   - Handle the two competing skews of time offset and time adjustment
     correctly by calculating the conflict portion between the skews and
     adjusting both accordingly.
 
   - A set of updates and improvements for the selftests
 
   - The usual small fixes and improvements all over the place
 -----BEGIN PGP SIGNATURE-----
 
 iQJEBAABCgAuFiEEQp8+kY+LLUocC4bMphj1TA10mKEFAmqCwxwQHHRnbHhAa2Vy
 bmVsLm9yZwAKCRCmGPVMDXSYoaOwD/45XBW2s5/L+GSy52r/APrzYOqgjYQdn2UQ
 XI85iTjDqg9sfZQNFbr7toJ84gY/wQ0ZxykLMi+LlOSZVe5azSepoUHMg9XGk8S0
 4kI+GLznmnDLFypTezpzk3DUgNgu8rhOYvPsgwQEgx0DuzWHRZgNoNDk4AfJ8HP6
 8cRgPIJ7CpIbP7/p0Kc5IjW3ybo849wBirl7ZDxNRRao+Dkc56ArZvSfQgnQu5Kw
 D3Ei+AFcxpBQ2GEJT4Z/92yNf1x2AXjkhfijgO6hIFzPAR+c049fG5sgneo3GoLQ
 riduEPQHvoiJO3gVGzoICF2DAuVOwMHwIBlGtNEDd+FcMAvMU4V3lQi8lJV+9CpH
 SJwa5R6KJHg2aTuoPup8lmfJN7BqmthrkZwcYVrv2Ikt5yWGYuoW0/e00So9IfUO
 R7UG/VlruckK+T0GCuKBAAfm/+zm6Sbir+4liPDZwDz4dW2lkvkZnAb6xHPCev8S
 ioYL/Jqr3GmIMgK7UelUkQ/gy5YCek89JAszdlD+blLAjUMcDeYsZaAN9rSdjzSu
 dbEA4Hze6Q8HpIW35bHkytyyjNNhvL6xobjKBNRuOPUHTFMe+s5itMApRlhsu32J
 6EL/D1TuwkiHlqaSek7ZqUAiitZoNWxa1NyreM9EuZ7qWPjUWOzlsDXkP2v298+t
 p27xt+/8sA==
 =prJt
 -----END PGP SIGNATURE-----

Merge tag 'timers-core-2026-08-17' of git://git.kernel.org/pub/scm/linux/kernel/git/tip/tip

Pull timer and timekeeping core updates from Thomas Gleixner:

 - Fix a subtly inconsistency in the timekeeping code, which fails to
   account for the monotonicity adjustment in ntp_error.

   For small changes of the clocksource multiplicator (+/-1) which are
   typically used by the NTP PLL this is hard to observe. But for larger
   adjustments, e.g. caused by a direct frequency setting through
   adjtimex() the one-time uncompensated offset is significant.

   Cure this by adjusting ntp_error with the resulting offset so that
   the discrepancy is smoothed away over time

 - Make tick length calculations correct in NTP.

   The timekeeping core takes the quantisation of the clocksource into
   account when calculating the tick length to compensate for the
   deviation of the nominal NTP_INTERVAL_LENGTH.

   While timekeeping gets this right, NTP is not aware of that, which
   means it operates on the nominal value and not on the actual value
   which is determined by the clock source frequency. The rounding of a
   coarse clocksource like the ACPI PM timer results in a +127 PPM
   deviation.

   Cure this by exposing the deviation to the NTP code so that it can
   operate on the same data as the timekeeping core. This is purely
   kernel internal. User space still sees the nominal tick lenght via
   adjtimex().

 - The accuracy of the NTP adjustments is fairly approximate as the code
   assumes that the invocations are precisely in NTP interval frequency
   ticks and the final adjustment can over and under-run.

   Cure this by adjusting ntp_error by the intended skew on each tick to
   achieve the desired rate.

 - Handle the two competing skews of time offset and time adjustment
   correctly by calculating the conflict portion between the skews and
   adjusting both accordingly.

 - A set of updates and improvements for the selftests

 - The usual small fixes and improvements all over the place

* tag 'timers-core-2026-08-17' of git://git.kernel.org/pub/scm/linux/kernel/git/tip/tip: (58 commits)
  selftests: timers: nsleep-lat: Check all calls to clock_nanosleep() and clock_gettime()
  selftests: timers: nsleep-lat: Reuse kselftest error numbers
  selftests: timers: nsleep-lat: Explicitly list the tested clocks
  selftests: timers: nsleep-lat: Use NSEC_PER_MSEC define for unreasonable latency
  selftests: timers: nanosleep: Report each test separately
  selftests: timers: nanosleep: Explicitly handle timer_delete() failure
  selftests: timers: nanosleep: Move all single clock tests out of the loop in main()
  selftests: timers: nanosleep: Reuse kselftest error numbers
  selftests: timers: nanosleep: Explicitly list the tested clocks
  selftests: timers: nanosleep: Drop output alignment
  selftests: timers: Use clock_name() and constants from clock-helpers.h
  selftests: Add clock-helpers.h
  timer_list: Use ktime_t over nanoseconds
  timer_list: Use standard 'long long' format placeholders
  hrtimer: Add a lockdep assertion to hrtimer_update_base()
  timekeeping: Use u32 for clock_was_set_seq
  timekeeping: Rename clockid_aux_valid() to clockid_is_aux_clock()
  hrtimer: Account nr_retries on recovered interrupt retries
  timers/itimer: Zero-init old itimerval before copy to userspace
  nohz: Replace dead select with choice default
  ...
2026-08-18 16:23:56 -07:00
..
ext sched_ext: Mark waker CPU busy when selected in WAKE_SYNC case 2026-07-22 07:55:28 -10:00
autogroup.c Convert 'alloc_obj' family to use the new default GFP_KERNEL argument 2026-02-21 17:09:51 -08:00
autogroup.h sched: Clean up and standardize #if/#else/#endif markers in sched/autogroup.[ch] 2025-06-13 08:47:14 +02:00
build_policy.c sched_ext: Move sources under kernel/sched/ext/ 2026-06-22 05:32:56 -10:00
build_utility.c sched/smp: Make SMP unconditional 2025-06-13 08:47:18 +02:00
clock.c sched/clock: Avoid false sharing for sched_clock_irqtime 2026-02-03 12:04:19 +01:00
completion.c sched: Make clangd usable 2025-06-11 11:20:53 +02:00
core_sched.c sched: Unify SMT active check via sched_smt_active() 2026-05-19 12:17:37 +02:00
core.c Scheduler updates for v7.3: 2026-08-18 13:39:48 -07:00
cpuacct.c Convert 'alloc_obj' family to use the new default GFP_KERNEL argument 2026-02-21 17:09:51 -08:00
cpudeadline.c Convert 'alloc_obj' family to use the new default GFP_KERNEL argument 2026-02-21 17:09:51 -08:00
cpudeadline.h sched/deadline: only set free_cpus for online runqueues 2025-10-16 11:13:49 +02:00
cpufreq_schedutil.c Merge back cpufreq material for 7.3 2026-07-31 16:22:32 +02:00
cpufreq.c sched: Make clangd usable 2025-06-11 11:20:53 +02:00
cpupri.c Convert 'alloc_obj' family to use the new default GFP_KERNEL argument 2026-02-21 17:09:51 -08:00
cpupri.h sched/smp: Make SMP unconditional 2025-06-13 08:47:18 +02:00
cputime.c Merge branch 'idle-time-acc' into features 2026-06-16 16:21:46 +02:00
deadline.c Merge branch 'sched/urgent' 2026-08-14 16:12:58 +02:00
debug.c sched/debug: Remove unused schedstats 2026-06-30 10:56:57 +02:00
fair.c Timers and timekeeping core updates: 2026-08-18 16:23:56 -07:00
features.h sched/rt: Have RT_PUSH_IPI be default off for non PREEMPT_RT 2026-05-19 12:17:39 +02:00
idle.c Scheduler updates for v7.2: 2026-06-15 14:50:18 +05:30
isolation.c sched/isolation: Defer freeing of cpumask memblock memory to initcall 2026-08-13 12:37:03 +02:00
loadavg.c Merge branch 'tip/sched/urgent' 2025-07-14 17:16:28 +02:00
Makefile sched: Enable context analysis for core.c and fair.c 2026-01-05 16:43:36 +01:00
membarrier.c Locking updates for v7.2: 2026-06-15 14:21:14 +05:30
pelt.c sched/eevdf: Move to a single runqueue 2026-06-30 10:56:53 +02:00
pelt.h sched/fair: Switch to task based throttle model 2025-09-03 10:03:14 +02:00
psi.c Merge branch 'sched/urgent' 2026-08-14 16:12:58 +02:00
rq-offsets.c sched: Make migrate_{en,dis}able() inline 2025-09-25 09:57:16 +02:00
rt.c sched/core: Fix inter-class wakeup_preempt() 2026-06-30 10:56:51 +02:00
sched-pelt.h sched: Make clangd usable 2025-06-11 11:20:53 +02:00
sched.h sched/fair: Reflow sched_balance_rq() 2026-06-30 10:56:56 +02:00
smp.h sched: Make clangd usable 2025-06-11 11:20:53 +02:00
stats.c sched/smp: Use the SMP version of schedstats 2025-06-13 08:47:21 +02:00
stats.h sched/fair: Co-locate cfs_rq and sched_entity in cfs_tg_state 2026-06-02 12:26:10 +02:00
stop_task.c sched: Rework prev_balance() to avoid stale prev references 2026-06-02 12:26:06 +02:00
swait.c sched: Make clangd usable 2025-06-11 11:20:53 +02:00
syscalls.c Linux 7.0-rc4 2026-03-17 07:14:42 +01:00
topology.c sched/topology: Restore SD_PREFER_SIBLING in domains with asymmetric capacity 2026-08-07 18:27:11 +02:00
wait_bit.c sched: Make clangd usable 2025-06-11 11:20:53 +02:00
wait.c ARM: 2025-07-30 17:14:01 -07:00