Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux
1
fork

Configure Feed

Select the types of activity you want to include in your feed.

timers/migration: Use scoped_guard on available flag set/clear

Cleanup tmigr_clear_cpu_available() and tmigr_set_cpu_available() to
prepare for easier checks on the available flag.

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-4-gmonaco@redhat.com

authored by

Gabriele Monaco and committed by
Thomas Gleixner
4c2374ed a048ca5f

+17 -17
+17 -17
kernel/time/timer_migration.c
··· 1440 1440 u64 firstexp; 1441 1441 1442 1442 cpumask_clear_cpu(cpu, tmigr_available_cpumask); 1443 - raw_spin_lock_irq(&tmc->lock); 1444 - tmc->available = false; 1445 - WRITE_ONCE(tmc->wakeup, KTIME_MAX); 1443 + scoped_guard(raw_spinlock_irq, &tmc->lock) { 1444 + tmc->available = false; 1445 + WRITE_ONCE(tmc->wakeup, KTIME_MAX); 1446 1446 1447 - /* 1448 - * CPU has to handle the local events on his own, when on the way to 1449 - * offline; Therefore nextevt value is set to KTIME_MAX 1450 - */ 1451 - firstexp = __tmigr_cpu_deactivate(tmc, KTIME_MAX); 1452 - trace_tmigr_cpu_unavailable(tmc); 1453 - raw_spin_unlock_irq(&tmc->lock); 1447 + /* 1448 + * CPU has to handle the local events on his own, when on the way to 1449 + * offline; Therefore nextevt value is set to KTIME_MAX 1450 + */ 1451 + firstexp = __tmigr_cpu_deactivate(tmc, KTIME_MAX); 1452 + trace_tmigr_cpu_unavailable(tmc); 1453 + } 1454 1454 1455 1455 if (firstexp != KTIME_MAX) { 1456 1456 migrator = cpumask_any(tmigr_available_cpumask); ··· 1469 1469 return -EINVAL; 1470 1470 1471 1471 cpumask_set_cpu(cpu, tmigr_available_cpumask); 1472 - raw_spin_lock_irq(&tmc->lock); 1473 - trace_tmigr_cpu_available(tmc); 1474 - tmc->idle = timer_base_is_idle(); 1475 - if (!tmc->idle) 1476 - __tmigr_cpu_activate(tmc); 1477 - tmc->available = true; 1478 - raw_spin_unlock_irq(&tmc->lock); 1472 + scoped_guard(raw_spinlock_irq, &tmc->lock) { 1473 + trace_tmigr_cpu_available(tmc); 1474 + tmc->idle = timer_base_is_idle(); 1475 + if (!tmc->idle) 1476 + __tmigr_cpu_activate(tmc); 1477 + tmc->available = true; 1478 + } 1479 1479 return 0; 1480 1480 } 1481 1481