Commit d614399b authored by Linus Torvalds's avatar Linus Torvalds
Browse files

Merge tag 'timers-core-2025-07-27' of git://git.kernel.org/pub/scm/linux/kernel/git/tip/tip

Pull timer core updates from Thomas Gleixner:

 - Simplify the logic in the timer migration code

 - Simplify the clocksource code by utilizing the more modern
   cpumask+*() interfaces

* tag 'timers-core-2025-07-27' of git://git.kernel.org/pub/scm/linux/kernel/git/tip/tip:
  clocksource: Use cpumask_next_wrap() in clocksource_watchdog()
  clocksource: Use cpumask_any_but() in clocksource_verify_choose_cpus()
  timers/migration: Clean up the loop in tmigr_quick_check()
parents 99e731bc bfa788dc
Loading
Loading
Loading
Loading
+2 −6
Original line number Diff line number Diff line
@@ -323,9 +323,7 @@ static void clocksource_verify_choose_cpus(void)
		return;

	/* Make sure to select at least one CPU other than the current CPU. */
	cpu = cpumask_first(cpu_online_mask);
	if (cpu == smp_processor_id())
		cpu = cpumask_next(cpu, cpu_online_mask);
	cpu = cpumask_any_but(cpu_online_mask, smp_processor_id());
	if (WARN_ON_ONCE(cpu >= nr_cpu_ids))
		return;
	cpumask_set_cpu(cpu, &cpus_chosen);
@@ -589,9 +587,7 @@ static void clocksource_watchdog(struct timer_list *unused)
	 * Cycle through CPUs to check if the CPUs stay synchronized
	 * to each other.
	 */
	next_cpu = cpumask_next(raw_smp_processor_id(), cpu_online_mask);
	if (next_cpu >= nr_cpu_ids)
		next_cpu = cpumask_first(cpu_online_mask);
	next_cpu = cpumask_next_wrap(raw_smp_processor_id(), cpu_online_mask);

	/*
	 * Arm timer if not already pending: could race with concurrent
+10 −13
Original line number Diff line number Diff line
@@ -1405,9 +1405,9 @@ u64 tmigr_quick_check(u64 nextevt)
		return KTIME_MAX;

	do {
		if (!tmigr_check_lonely(group)) {
		if (!tmigr_check_lonely(group))
			return KTIME_MAX;
		} else {

		/*
		 * Since current CPU is active, events may not be sorted
		 * from bottom to the top because the CPU's event is ignored
@@ -1415,13 +1415,10 @@ u64 tmigr_quick_check(u64 nextevt)
		 * Thus keep track of the lowest observed expiry.
		 */
		nextevt = min_t(u64, nextevt, READ_ONCE(group->next_expiry));
			if (!group->parent)
				return nextevt;
		}
		group = group->parent;
	} while (group);

	return KTIME_MAX;
	return nextevt;
}

/*