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: Add mask for CPUs available in the hierarchy

Keep track of the CPUs available for timer migration in a cpumask. This
prepares the ground to generalise the concept of unavailable 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-3-gmonaco@redhat.com

authored by

Gabriele Monaco and committed by
Thomas Gleixner
a048ca5f 8312cab5

+14 -1
+14 -1
kernel/time/timer_migration.c
··· 424 424 425 425 static DEFINE_PER_CPU(struct tmigr_cpu, tmigr_cpu); 426 426 427 + /* 428 + * CPUs available for timer migration. 429 + * Protected by cpuset_mutex (with cpus_read_lock held) or cpus_write_lock. 430 + */ 431 + static cpumask_var_t tmigr_available_cpumask; 432 + 427 433 #define TMIGR_NONE 0xFF 428 434 #define BIT_CNT 8 429 435 ··· 1439 1433 int migrator; 1440 1434 u64 firstexp; 1441 1435 1436 + cpumask_clear_cpu(cpu, tmigr_available_cpumask); 1442 1437 raw_spin_lock_irq(&tmc->lock); 1443 1438 tmc->available = false; 1444 1439 WRITE_ONCE(tmc->wakeup, KTIME_MAX); ··· 1453 1446 raw_spin_unlock_irq(&tmc->lock); 1454 1447 1455 1448 if (firstexp != KTIME_MAX) { 1456 - migrator = cpumask_any_but(cpu_online_mask, cpu); 1449 + migrator = cpumask_any(tmigr_available_cpumask); 1457 1450 work_on_cpu(migrator, tmigr_trigger_active, NULL); 1458 1451 } 1459 1452 ··· 1468 1461 if (WARN_ON_ONCE(!tmc->tmgroup)) 1469 1462 return -EINVAL; 1470 1463 1464 + cpumask_set_cpu(cpu, tmigr_available_cpumask); 1471 1465 raw_spin_lock_irq(&tmc->lock); 1472 1466 trace_tmigr_cpu_available(tmc); 1473 1467 tmc->idle = timer_base_is_idle(); ··· 1812 1804 /* Nothing to do if running on UP */ 1813 1805 if (ncpus == 1) 1814 1806 return 0; 1807 + 1808 + if (!zalloc_cpumask_var(&tmigr_available_cpumask, GFP_KERNEL)) { 1809 + ret = -ENOMEM; 1810 + goto err; 1811 + } 1815 1812 1816 1813 /* 1817 1814 * Calculate the required hierarchy levels. Unfortunately there is no