public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
* [PATCH] hrtimer: select housekeeping CPU during migration
@ 2024-02-11 13:52 Costa Shulyupin
  2024-02-11 16:37 ` Waiman Long
                   ` (3 more replies)
  0 siblings, 4 replies; 13+ messages in thread
From: Costa Shulyupin @ 2024-02-11 13:52 UTC (permalink / raw)
  To: Waiman Long, Thomas Gleixner, linux-kernel; +Cc: Costa Shulyupin

because during CPU deactivation a timer can migrate
to isolated CPU and break CPU isolation.

For reference see function get_nohz_timer_target,
which selects CPU for new timers from housekeeping_cpumask(HK_TYPE_TIMER)

Inspired by Waiman Long <longman@redhat.com>

Signed-off-by: Costa Shulyupin <costa.shul@redhat.com>
---
 kernel/time/hrtimer.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/kernel/time/hrtimer.c b/kernel/time/hrtimer.c
index f82997cf53b6..460d916e24b7 100644
--- a/kernel/time/hrtimer.c
+++ b/kernel/time/hrtimer.c
@@ -2227,7 +2227,7 @@ static void migrate_hrtimer_list(struct hrtimer_clock_base *old_base,
 int hrtimers_cpu_dying(unsigned int dying_cpu)
 {
 	struct hrtimer_cpu_base *old_base, *new_base;
-	int i, ncpu = cpumask_first(cpu_active_mask);
+	int i, ncpu = cpumask_any_and(cpu_active_mask, housekeeping(HK_TYPE_TIMER));
 	pr_debug("ncpu=%d, dying_cpu=%d\n", ncpu, dying_cpu);
 
 	tick_cancel_sched_timer(dying_cpu);
-- 
2.43.0


^ permalink raw reply related	[flat|nested] 13+ messages in thread

end of thread, other threads:[~2024-02-22 21:24 UTC | newest]

Thread overview: 13+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2024-02-11 13:52 [PATCH] hrtimer: select housekeeping CPU during migration Costa Shulyupin
2024-02-11 16:37 ` Waiman Long
2024-02-12 15:23 ` Frederic Weisbecker
2024-02-13 12:36 ` Thomas Gleixner
2024-02-13 16:46 ` [PATCH v2] " Costa Shulyupin
2024-02-13 19:41   ` Thomas Gleixner
2024-02-13 19:49   ` [tip: timers/core] hrtimer: Select " tip-bot2 for Costa Shulyupin
2024-02-14  9:01   ` [PATCH v2] hrtimer: select " Borislav Petkov
2024-02-14  9:10   ` Thomas Gleixner
2024-02-19 14:33   ` [PATCH v3] " Costa Shulyupin
2024-02-19 16:27     ` Thomas Gleixner
2024-02-22 20:08     ` [PATCH v4] " Costa Shulyupin
2024-02-22 21:24       ` [tip: timers/core] hrtimer: Select " tip-bot2 for Costa Shulyupin

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox