From: "tip-bot2 for Frederic Weisbecker" <tip-bot2@linutronix.de>
To: linux-tip-commits@vger.kernel.org
Cc: Frederic Weisbecker <frederic@kernel.org>,
Thomas Gleixner <tglx@kernel.org>,
x86@kernel.org, linux-kernel@vger.kernel.org
Subject: [tip: timers/core] timers/migration: Fix hotplug migrator selection target on asymetric capacity machines
Date: Tue, 02 Jun 2026 19:35:53 -0000 [thread overview]
Message-ID: <178042895350.710.17312754281444205130.tip-bot2@tip-bot2> (raw)
In-Reply-To: <20260519220926.63437-2-frederic@kernel.org>
The following commit has been merged into the timers/core branch of tip:
Commit-ID: e4a70f5fbd43f55b474028a2cee3d78e4b443dd7
Gitweb: https://git.kernel.org/tip/e4a70f5fbd43f55b474028a2cee3d78e4b443dd7
Author: Frederic Weisbecker <frederic@kernel.org>
AuthorDate: Wed, 20 May 2026 00:09:25 +02:00
Committer: Thomas Gleixner <tglx@kernel.org>
CommitterDate: Tue, 02 Jun 2026 21:34:03 +02:00
timers/migration: Fix hotplug migrator selection target on asymetric capacity machines
When a top-level migrator is deactivated, either at CPU down hotplug time
or when a CPU is domain isolated, a new migrator is elected among the
available CPUs and woken up to take over the migration duty.
However that election must happen at the scope of a given hierarchy and not
globally, which the introduction of per-capacity hierarchies failed to
handle.
As a result a given hierarchy may end up without migrator to handle global
timers.
Fix it by making sure that the new migrator belongs to the same hierarchy
as the outgoing CPU.
Fixes: 098cbaad8e57 ("timers/migration: Split per-capacity hierarchies")
Signed-off-by: Frederic Weisbecker <frederic@kernel.org>
Signed-off-by: Thomas Gleixner <tglx@kernel.org>
Link: https://patch.msgid.link/20260519220926.63437-2-frederic@kernel.org
---
kernel/time/timer_migration.c | 42 +++++++++++++++++++++++++---------
1 file changed, 32 insertions(+), 10 deletions(-)
diff --git a/kernel/time/timer_migration.c b/kernel/time/timer_migration.c
index 25e3c56..8032b00 100644
--- a/kernel/time/timer_migration.c
+++ b/kernel/time/timer_migration.c
@@ -1464,6 +1464,18 @@ static long tmigr_trigger_active(void *unused)
return 0;
}
+static struct tmigr_hierarchy *__tmigr_get_hierarchy(unsigned int capacity)
+{
+ struct tmigr_hierarchy *iter;
+
+ list_for_each_entry(iter, &tmigr_hierarchy_list, node) {
+ if (iter->capacity == capacity)
+ return iter;
+ }
+
+ return NULL;
+}
+
static int tmigr_clear_cpu_available(unsigned int cpu)
{
struct tmigr_cpu *tmc = this_cpu_ptr(&tmigr_cpu);
@@ -1488,8 +1500,21 @@ static int tmigr_clear_cpu_available(unsigned int cpu)
}
if (firstexp != KTIME_MAX) {
- migrator = cpumask_any(tmigr_available_cpumask);
- work_on_cpu(migrator, tmigr_trigger_active, NULL);
+ struct tmigr_hierarchy *hier = __tmigr_get_hierarchy(arch_scale_cpu_capacity(cpu));
+
+ if (WARN_ON_ONCE(!hier))
+ return -EINVAL;
+
+ migrator = cpumask_any_and(tmigr_available_cpumask, hier->cpumask);
+ if (migrator < nr_cpu_ids) {
+ work_on_cpu(migrator, tmigr_trigger_active, NULL);
+ } else {
+ /*
+ * If deactivation returned an expiration, it belongs to an available
+ * nohz CPU in the hierarchy.
+ */
+ WARN_ONCE(1, "Expected available CPU in the hierarchy\n");
+ }
}
return 0;
@@ -1915,12 +1940,9 @@ out:
static struct tmigr_hierarchy *tmigr_get_hierarchy(unsigned int capacity)
{
- struct tmigr_hierarchy *hier = NULL, *iter;
+ struct tmigr_hierarchy *hier;
- list_for_each_entry(iter, &tmigr_hierarchy_list, node) {
- if (iter->capacity == capacity)
- hier = iter;
- }
+ hier = __tmigr_get_hierarchy(capacity);
if (hier)
return hier;
@@ -1978,9 +2000,9 @@ static long connect_old_root_work(void *arg)
struct tmigr_hierarchy *hier;
int cpu = smp_processor_id();
- hier = tmigr_get_hierarchy(arch_scale_cpu_capacity(cpu));
- if (IS_ERR(hier))
- return PTR_ERR(hier);
+ hier = __tmigr_get_hierarchy(arch_scale_cpu_capacity(cpu));
+ if (WARN_ON_ONCE(!hier))
+ return -EINVAL;
return tmigr_connect_old_root(hier, cpu, old_root, true);
}
next prev parent reply other threads:[~2026-06-02 19:35 UTC|newest]
Thread overview: 8+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-05-19 22:09 [PATCH 0/2] timers/migration: Fixes on top of per capacity hierarchies Frederic Weisbecker
2026-05-19 22:09 ` [PATCH 1/2] timers/migration: Fix hotplug migrator selection target on asymetric capacity machines Frederic Weisbecker
2026-06-02 19:35 ` tip-bot2 for Frederic Weisbecker [this message]
[not found] ` <CGME20260608094538eucas1p1b87572e8b8af819ccb1537c38cd51957@eucas1p1.samsung.com>
2026-06-08 9:45 ` Marek Szyprowski
2026-06-08 14:04 ` Frederic Weisbecker
2026-06-08 14:15 ` Marek Szyprowski
2026-05-19 22:09 ` [PATCH 2/2] timers/migration: Deactivate per-capacity hierarchies under nohz_full Frederic Weisbecker
2026-06-02 19:35 ` [tip: timers/core] " tip-bot2 for Frederic Weisbecker
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=178042895350.710.17312754281444205130.tip-bot2@tip-bot2 \
--to=tip-bot2@linutronix.de \
--cc=frederic@kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-tip-commits@vger.kernel.org \
--cc=tglx@kernel.org \
--cc=x86@kernel.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox
all inboxes | Powered by JetHome®