Skip to content

Commit 8312cab

Browse files
glemcoKAGA-KOKO
authored andcommitted
timers/migration: Rename 'online' bit to 'available'
The timer migration hierarchy excludes offline CPUs via the tmigr_is_not_available function, which is essentially checking the online bit for the CPU. Rename the online bit to available and all references in function names and tracepoint to generalise the concept of available CPUs. Signed-off-by: Gabriele Monaco <gmonaco@redhat.com> Signed-off-by: Thomas Gleixner <tglx@linutronix.de> Reviewed-by: Frederic Weisbecker <frederic@kernel.org> Reviewed-by: Thomas Gleixner <tglx@linutronix.de> Link: https://patch.msgid.link/20251120145653.296659-2-gmonaco@redhat.com
1 parent 308bc2e commit 8312cab

3 files changed

Lines changed: 15 additions & 15 deletions

File tree

include/trace/events/timer_migration.h

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -173,14 +173,14 @@ DEFINE_EVENT(tmigr_cpugroup, tmigr_cpu_active,
173173
TP_ARGS(tmc)
174174
);
175175

176-
DEFINE_EVENT(tmigr_cpugroup, tmigr_cpu_online,
176+
DEFINE_EVENT(tmigr_cpugroup, tmigr_cpu_available,
177177

178178
TP_PROTO(struct tmigr_cpu *tmc),
179179

180180
TP_ARGS(tmc)
181181
);
182182

183-
DEFINE_EVENT(tmigr_cpugroup, tmigr_cpu_offline,
183+
DEFINE_EVENT(tmigr_cpugroup, tmigr_cpu_unavailable,
184184

185185
TP_PROTO(struct tmigr_cpu *tmc),
186186

kernel/time/timer_migration.c

Lines changed: 12 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -429,7 +429,7 @@ static DEFINE_PER_CPU(struct tmigr_cpu, tmigr_cpu);
429429

430430
static inline bool tmigr_is_not_available(struct tmigr_cpu *tmc)
431431
{
432-
return !(tmc->tmgroup && tmc->online);
432+
return !(tmc->tmgroup && tmc->available);
433433
}
434434

435435
/*
@@ -926,7 +926,7 @@ static void tmigr_handle_remote_cpu(unsigned int cpu, u64 now,
926926
* updated the event takes care when hierarchy is completely
927927
* idle. Otherwise the migrator does it as the event is enqueued.
928928
*/
929-
if (!tmc->online || tmc->remote || tmc->cpuevt.ignore ||
929+
if (!tmc->available || tmc->remote || tmc->cpuevt.ignore ||
930930
now < tmc->cpuevt.nextevt.expires) {
931931
raw_spin_unlock_irq(&tmc->lock);
932932
return;
@@ -973,7 +973,7 @@ static void tmigr_handle_remote_cpu(unsigned int cpu, u64 now,
973973
* (See also section "Required event and timerqueue update after a
974974
* remote expiry" in the documentation at the top)
975975
*/
976-
if (!tmc->online || !tmc->idle) {
976+
if (!tmc->available || !tmc->idle) {
977977
timer_unlock_remote_bases(cpu);
978978
goto unlock;
979979
}
@@ -1422,27 +1422,27 @@ static long tmigr_trigger_active(void *unused)
14221422
{
14231423
struct tmigr_cpu *tmc = this_cpu_ptr(&tmigr_cpu);
14241424

1425-
WARN_ON_ONCE(!tmc->online || tmc->idle);
1425+
WARN_ON_ONCE(!tmc->available || tmc->idle);
14261426

14271427
return 0;
14281428
}
14291429

1430-
static int tmigr_cpu_offline(unsigned int cpu)
1430+
static int tmigr_clear_cpu_available(unsigned int cpu)
14311431
{
14321432
struct tmigr_cpu *tmc = this_cpu_ptr(&tmigr_cpu);
14331433
int migrator;
14341434
u64 firstexp;
14351435

14361436
raw_spin_lock_irq(&tmc->lock);
1437-
tmc->online = false;
1437+
tmc->available = false;
14381438
WRITE_ONCE(tmc->wakeup, KTIME_MAX);
14391439

14401440
/*
14411441
* CPU has to handle the local events on his own, when on the way to
14421442
* offline; Therefore nextevt value is set to KTIME_MAX
14431443
*/
14441444
firstexp = __tmigr_cpu_deactivate(tmc, KTIME_MAX);
1445-
trace_tmigr_cpu_offline(tmc);
1445+
trace_tmigr_cpu_unavailable(tmc);
14461446
raw_spin_unlock_irq(&tmc->lock);
14471447

14481448
if (firstexp != KTIME_MAX) {
@@ -1453,7 +1453,7 @@ static int tmigr_cpu_offline(unsigned int cpu)
14531453
return 0;
14541454
}
14551455

1456-
static int tmigr_cpu_online(unsigned int cpu)
1456+
static int tmigr_set_cpu_available(unsigned int cpu)
14571457
{
14581458
struct tmigr_cpu *tmc = this_cpu_ptr(&tmigr_cpu);
14591459

@@ -1462,11 +1462,11 @@ static int tmigr_cpu_online(unsigned int cpu)
14621462
return -EINVAL;
14631463

14641464
raw_spin_lock_irq(&tmc->lock);
1465-
trace_tmigr_cpu_online(tmc);
1465+
trace_tmigr_cpu_available(tmc);
14661466
tmc->idle = timer_base_is_idle();
14671467
if (!tmc->idle)
14681468
__tmigr_cpu_activate(tmc);
1469-
tmc->online = true;
1469+
tmc->available = true;
14701470
raw_spin_unlock_irq(&tmc->lock);
14711471
return 0;
14721472
}
@@ -1758,7 +1758,7 @@ static int tmigr_add_cpu(unsigned int cpu)
17581758
* The (likely) current CPU is expected to be online in the hierarchy,
17591759
* otherwise the old root may not be active as expected.
17601760
*/
1761-
WARN_ON_ONCE(!per_cpu_ptr(&tmigr_cpu, raw_smp_processor_id())->online);
1761+
WARN_ON_ONCE(!per_cpu_ptr(&tmigr_cpu, raw_smp_processor_id())->available);
17621762
ret = tmigr_setup_groups(-1, old_root->numa_node, old_root, true);
17631763
}
17641764

@@ -1854,7 +1854,7 @@ static int __init tmigr_init(void)
18541854
goto err;
18551855

18561856
ret = cpuhp_setup_state(CPUHP_AP_TMIGR_ONLINE, "tmigr:online",
1857-
tmigr_cpu_online, tmigr_cpu_offline);
1857+
tmigr_set_cpu_available, tmigr_clear_cpu_available);
18581858
if (ret)
18591859
goto err;
18601860

kernel/time/timer_migration.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -97,7 +97,7 @@ struct tmigr_group {
9797
*/
9898
struct tmigr_cpu {
9999
raw_spinlock_t lock;
100-
bool online;
100+
bool available;
101101
bool idle;
102102
bool remote;
103103
struct tmigr_group *tmgroup;

0 commit comments

Comments
 (0)