Skip to content

Commit 56c2cb1

Browse files
makelinuxKAGA-KOKO
authored andcommitted
hrtimer: Select housekeeping CPU during migration
During CPU-down hotplug, hrtimers may migrate to isolated CPUs, compromising CPU isolation. Address this issue by masking valid CPUs for hrtimers using housekeeping_cpumask(HK_TYPE_TIMER). Suggested-by: Waiman Long <longman@redhat.com> Signed-off-by: Costa Shulyupin <costa.shul@redhat.com> Signed-off-by: Thomas Gleixner <tglx@linutronix.de> Reviewed-by: Waiman Long <longman@redhat.com> Link: https://lore.kernel.org/r/20240222200856.569036-1-costa.shul@redhat.com
1 parent b2cf750 commit 56c2cb1

File tree

1 file changed

+2
-1
lines changed

1 file changed

+2
-1
lines changed

kernel/time/hrtimer.c

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -38,6 +38,7 @@
3838
#include <linux/sched/deadline.h>
3939
#include <linux/sched/nohz.h>
4040
#include <linux/sched/debug.h>
41+
#include <linux/sched/isolation.h>
4142
#include <linux/timer.h>
4243
#include <linux/freezer.h>
4344
#include <linux/compat.h>
@@ -2225,8 +2226,8 @@ static void migrate_hrtimer_list(struct hrtimer_clock_base *old_base,
22252226

22262227
int hrtimers_cpu_dying(unsigned int dying_cpu)
22272228
{
2229+
int i, ncpu = cpumask_any_and(cpu_active_mask, housekeeping_cpumask(HK_TYPE_TIMER));
22282230
struct hrtimer_cpu_base *old_base, *new_base;
2229-
int i, ncpu = cpumask_first(cpu_active_mask);
22302231

22312232
tick_cancel_sched_timer(dying_cpu);
22322233

0 commit comments

Comments
 (0)