Skip to content

Commit d614399

Browse files
committed
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()
2 parents 99e731b + bfa788d commit d614399

File tree

2 files changed

+12
-19
lines changed

2 files changed

+12
-19
lines changed

kernel/time/clocksource.c

Lines changed: 2 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -323,9 +323,7 @@ static void clocksource_verify_choose_cpus(void)
323323
return;
324324

325325
/* Make sure to select at least one CPU other than the current CPU. */
326-
cpu = cpumask_first(cpu_online_mask);
327-
if (cpu == smp_processor_id())
328-
cpu = cpumask_next(cpu, cpu_online_mask);
326+
cpu = cpumask_any_but(cpu_online_mask, smp_processor_id());
329327
if (WARN_ON_ONCE(cpu >= nr_cpu_ids))
330328
return;
331329
cpumask_set_cpu(cpu, &cpus_chosen);
@@ -589,9 +587,7 @@ static void clocksource_watchdog(struct timer_list *unused)
589587
* Cycle through CPUs to check if the CPUs stay synchronized
590588
* to each other.
591589
*/
592-
next_cpu = cpumask_next(raw_smp_processor_id(), cpu_online_mask);
593-
if (next_cpu >= nr_cpu_ids)
594-
next_cpu = cpumask_first(cpu_online_mask);
590+
next_cpu = cpumask_next_wrap(raw_smp_processor_id(), cpu_online_mask);
595591

596592
/*
597593
* Arm timer if not already pending: could race with concurrent

kernel/time/timer_migration.c

Lines changed: 10 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -1405,23 +1405,20 @@ u64 tmigr_quick_check(u64 nextevt)
14051405
return KTIME_MAX;
14061406

14071407
do {
1408-
if (!tmigr_check_lonely(group)) {
1408+
if (!tmigr_check_lonely(group))
14091409
return KTIME_MAX;
1410-
} else {
1411-
/*
1412-
* Since current CPU is active, events may not be sorted
1413-
* from bottom to the top because the CPU's event is ignored
1414-
* up to the top and its sibling's events not propagated upwards.
1415-
* Thus keep track of the lowest observed expiry.
1416-
*/
1417-
nextevt = min_t(u64, nextevt, READ_ONCE(group->next_expiry));
1418-
if (!group->parent)
1419-
return nextevt;
1420-
}
1410+
1411+
/*
1412+
* Since current CPU is active, events may not be sorted
1413+
* from bottom to the top because the CPU's event is ignored
1414+
* up to the top and its sibling's events not propagated upwards.
1415+
* Thus keep track of the lowest observed expiry.
1416+
*/
1417+
nextevt = min_t(u64, nextevt, READ_ONCE(group->next_expiry));
14211418
group = group->parent;
14221419
} while (group);
14231420

1424-
return KTIME_MAX;
1421+
return nextevt;
14251422
}
14261423

14271424
/*

0 commit comments

Comments
 (0)