Skip to contentSkip to conversation

sched/rt: rto_next_cpu: Skip CPUs with NEED_RESCHED

PATCH In review Chen Jinghuang 2 participants 8 messages Nov 21, 2025 – Dec 4, 2025 Scheduler

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 sched/rt: rto_next_cpu: Skip CPUs with NEED_RESCHED

CPU0 becomes overloaded when hosting a CPU-bound RT task, a non-CPU-bound RT task, and a CFS task stuck in kernel space. When other CPUs switch from RT to non-RT tasks, RT load balancing (LB) is triggered; with HAVE_RT_PUSH_IPI enabled, they send IPIs to CPU0 to drive the execution of rto_push_irq_work_func. During push_rt_task on CPU0,
if next_task->prio < rq->donor->prio, resched_curr() sets NEED_RESCHED and after the push operation completes, CPU0 calls rto_next_cpu(). Since only CPU0 is overloaded in this scenario, rto_next_cpu() should ideally return -1 (no further IPI needed).

However, multiple CPUs invoking tell_cpu_to_push() during LB increments rd->rto_loop_next. Even when rd->rto_cpu is set to -1, the mismatch between rd->rto_loop and rd->rto_loop_next forces rto next_cpu() to restart its search from -1. With CPU0 remaining overloaded(""satisfying rt_nr_migratory && rt_nr_total > 1), it gets reselected, causing CPU0 to queue irq_work to itself and send self-IPIs repeatedly. As long as CPU0 stays overloaded and other CPUs run pull_rt_tasks(), it falls into an infinite self-IPI loop, wasting CPU cycles on unnecessary interrupt handling.

The triggering scenario is as follows:

cpu0 cpu1 cpu2
pull_rt_task
tell_cpu_to_push
<------------irq_work_queue_on
rto_push_irq_work_func

       push_rt_task
    resched_curr(rq)                                      pull_rt_task
    rto_next_cpu                                        tell_cpu_to_push
     			 <-------------------------- atomic_inc(rto_loop_next)

rd->rto_loop != next
rto_next_cpu
irq_work_queue_on
rto_push_irq_work_func

Fix redundant self-IPI/cross-CPU IPI when target CPU already has a pending reschedule, making the IPI unnecessary.

---
 kernel/sched/rt.c | 14 +++++++++++++-
 1 file changed, 13 insertions(+), 1 deletion(-)
kernel/sched/rt.c +13 -1
index 7936d4333731..29ce1af9f121 100644
@@ -2123,8 +2123,20 @@ static int rto_next_cpu(struct root_domain *rd)
 
 		rd->rto_cpu = cpu;
 
-		if (cpu < nr_cpu_ids)
+		if (cpu < nr_cpu_ids) {
+			struct task_struct *t;
+			struct rq *rq = cpu_rq(cpu);
+
+			rcu_read_lock();
+			t = rcu_dereference(rq->curr);
+			if (test_tsk_need_resched(t)) {
+				rcu_read_unlock();
+				continue;
+			}
+			rcu_read_unlock();
+
 			return cpu;
+		}
 
 		rd->rto_cpu = -1;
 
Signature · 1 line
2.34.1
#1 lore raw
Quoted 10 lines · On Fri, 21 Nov 2025 01:40:04 +0000 Chen Jinghuang <[email protected]>…

CPU0 becomes overloaded when hosting a CPU-bound RT task, a non-CPU-bound RT task, and a CFS task stuck in kernel space. When other CPUs switch from RT to non-RT tasks, RT load balancing (LB) is triggered; with HAVE_RT_PUSH_IPI enabled, they send IPIs to CPU0 to drive the execution of rto_push_irq_work_func. During push_rt_task on CPU0,
if next_task->prio < rq->donor->prio, resched_curr() sets NEED_RESCHED and after the push operation completes, CPU0 calls rto_next_cpu(). Since only CPU0 is overloaded in this scenario, rto_next_cpu() should ideally return -1 (no further IPI needed).

Quoted 8 lines

However, multiple CPUs invoking tell_cpu_to_push() during LB increments rd->rto_loop_next. Even when rd->rto_cpu is set to -1, the mismatch between rd->rto_loop and rd->rto_loop_next forces rto next_cpu() to restart its search from -1. With CPU0 remaining overloaded(""satisfying rt_nr_migratory && rt_nr_total > 1), it gets reselected, causing CPU0 to queue irq_work to itself and send self-IPIs repeatedly. As long as CPU0 stays overloaded and other CPUs run pull_rt_tasks(), it falls into an infinite self-IPI loop, wasting CPU cycles on unnecessary interrupt handling.

Is it truly "infinite", or just wasted due to other CPUs requesting a pull?

Also, it appears the issue here is that it's sending to itself.

Quoted 41 lines

The triggering scenario is as follows:

cpu0 cpu1 cpu2
pull_rt_task
tell_cpu_to_push
<------------irq_work_queue_on
rto_push_irq_work_func

       push_rt_task
    resched_curr(rq)                                      pull_rt_task
    rto_next_cpu                                        tell_cpu_to_push
     			 <-------------------------- atomic_inc(rto_loop_next)

rd->rto_loop != next
rto_next_cpu
irq_work_queue_on
rto_push_irq_work_func

Fix redundant self-IPI/cross-CPU IPI when target CPU already has a pending reschedule, making the IPI unnecessary.

---
 kernel/sched/rt.c | 14 +++++++++++++-
 1 file changed, 13 insertions(+), 1 deletion(-)
kernel/sched/rt.c +7 -1
index 7936d4333731..29ce1af9f121 100644
@@ -2123,8 +2123,20 @@ static int rto_next_cpu(struct root_domain *rd)
 
 		rd->rto_cpu = cpu;
 
-		if (cpu < nr_cpu_ids)
+		if (cpu < nr_cpu_ids) {
+			struct task_struct *t;
+			struct rq *rq = cpu_rq(cpu);
+
+			rcu_read_lock();
+			t = rcu_dereference(rq->curr);
+			if (test_tsk_need_resched(t)) {

kernel/sched/rt.c static int rto_next_cpu(struct root_domain *rd) · line 2142

Quoted 10 lines
kernel/sched/rt.c +6 -0
+				rcu_read_unlock();
+				continue;
+			}
+			rcu_read_unlock();
+
 			return cpu;
+		}
 
 		rd->rto_cpu = -1;
 

Instead of skipping need resched, would skipping the current CPU work too?

kernel/sched/rt.c +7 -3
index 7936d4333731..cacd8912cd31 100644
@@ -2100,6 +2100,7 @@ static void push_rt_tasks(struct rq *rq)
  */
 static int rto_next_cpu(struct root_domain *rd)
 {
+	int this_cpu = smp_processor_id();
 	int next;
 	int cpu;
 
@@ -2118,10 +2119,13 @@ static int rto_next_cpu(struct root_domain *rd)
 	 */
 	for (;;) {
 
-		/* When rto_cpu is -1 this acts like cpumask_first() */
-		cpu = cpumask_next(rd->rto_cpu, rd->rto_mask);
+		do {
+			/* When rto_cpu is -1 this acts like cpumask_first() */
+			cpu = cpumask_next(rd->rto_cpu, rd->rto_mask);
+			rd->rto_cpu = cpu;
 
-		rd->rto_cpu = cpu;
+			/* Do not send IPI to self */
+		} while (cpu == this_cpu);
 
 		if (cpu < nr_cpu_ids)
 			return cpu;

-- Steve

#2 lore raw

-----邮件原件-----
发件人: Steven Rostedt <[email protected]>
发送时间: 2025年11月22日 1:38
收件人: chenjinghuang <[email protected]>
抄送: [email protected]; [email protected]; [email protected]; [email protected]; [email protected]; [email protected]; [email protected]; [email protected]; [email protected] 主题: Re: [PATCH] sched/rt: rto_next_cpu: Skip CPUs with NEED_RESCHED

Quoted 10 lines · On Fri, 21 Nov 2025 01:40:04 +0000 Chen Jinghuang <[email protected]>…

CPU0 becomes overloaded when hosting a CPU-bound RT task, a non-CPU-bound RT task, and a CFS task stuck in kernel space. When other CPUs switch from RT to non-RT tasks, RT load balancing (LB) is triggered; with HAVE_RT_PUSH_IPI enabled, they send IPIs to CPU0 to drive the execution of rto_push_irq_work_func. During push_rt_task on CPU0, if next_task->prio < rq->donor->prio, resched_curr() sets NEED_RESCHED and after the push operation completes, CPU0 calls rto_next_cpu(). Since only CPU0 is overloaded in this scenario, rto_next_cpu() should ideally return -1 (no further IPI needed).

Quoted 10 lines

However, multiple CPUs invoking tell_cpu_to_push() during LB
increments
rd->rto_loop_next. Even when rd->rto_cpu is set to -1, the mismatch rd->between rto_loop and rd->rto_loop_next forces rto next_cpu() to rd->restart its
search from -1. With CPU0 remaining overloaded(""satisfying rt_nr_migratory && rt_nr_total > 1), it gets reselected, causing CPU0 to queue irq_work to itself and send self-IPIs repeatedly. As long as CPU0 stays overloaded and other CPUs run pull_rt_tasks(), it falls
into an infinite self-IPI loop, wasting CPU cycles on unnecessary interrupt handling.

Is it truly "infinite", or just wasted due to other CPUs requesting a pull?

Also, it appears the issue here is that it's sending to itself.

The IPI explosion in this scenario is caused by two combined factors-cross-CPU IPIs triggered by other CPUs repeatedly initiating pull_rt_tasks(), and self-IPIs sent by CPU0 after reselecting itself in rto_next_cpu(). These two factors form a chain reaction, resulting in a "de facto infinite stream of redundant IPIs" while CPU0 remains overloaded.

Quoted 40 lines

The triggering scenario is as follows:

         cpu0	        	   cpu1               	      cpu2
                   	        pull_rt_task
	                      tell_cpu_to_push
                 <------------irq_work_queue_on rto_push_irq_work_func
       push_rt_task
    resched_curr(rq)                                      pull_rt_task
    rto_next_cpu                                        tell_cpu_to_push
     			 <-------------------------- atomic_inc(rto_loop_next)

rd->rto_loop != next
rto_next_cpu
irq_work_queue_on
rto_push_irq_work_func

Fix redundant self-IPI/cross-CPU IPI when target CPU already has a pending reschedule, making the IPI unnecessary.

---
 kernel/sched/rt.c | 14 +++++++++++++-
 1 file changed, 13 insertions(+), 1 deletion(-)
kernel/sched/rt.c index renamed from kernel/sched/rt.c +0 -0

7936d4333731..29ce1af9f121 100644

kernel/sched/rt.c +7 -1
@@ -2123,8 +2123,20 @@ static int rto_next_cpu(struct root_domain *rd)
 
 		rd->rto_cpu = cpu;
 
-		if (cpu < nr_cpu_ids)
+		if (cpu < nr_cpu_ids) {
+			struct task_struct *t;
+			struct rq *rq = cpu_rq(cpu);
+
+			rcu_read_lock();
+			t = rcu_dereference(rq->curr);
+			if (test_tsk_need_resched(t)) {

kernel/sched/rt.c static int rto_next_cpu(struct root_domain *rd) · line 2142

Quoted 10 lines
kernel/sched/rt.c +6 -0
+				rcu_read_unlock();
+				continue;
+			}
+			rcu_read_unlock();
+
 			return cpu;
+		}
 
 		rd->rto_cpu = -1;
 

Instead of skipping need resched, would skipping the current CPU work too?

Acknowledge that "sending IPI to itself" is the direct trigger for the loop. The original approach of checking NEED_RESCHED was an indirect optimization that did not address the core issue.

kernel/sched/rt.c +7 -3
@@ -2100,6 +2100,7 @@ static void push_rt_tasks(struct rq *rq)
  */
 static int rto_next_cpu(struct root_domain *rd)  {
+	int this_cpu = smp_processor_id();
 	int next;
 	int cpu;
 
@@ -2118,10 +2119,13 @@ static int rto_next_cpu(struct root_domain *rd)
 	 */
 	for (;;) {
 
-		/* When rto_cpu is -1 this acts like cpumask_first() */
-		cpu = cpumask_next(rd->rto_cpu, rd->rto_mask);
+		do {
+			/* When rto_cpu is -1 this acts like cpumask_first() */
+			cpu = cpumask_next(rd->rto_cpu, rd->rto_mask);
+			rd->rto_cpu = cpu;
 
-		rd->rto_cpu = cpu;
+			/* Do not send IPI to self */
+		} while (cpu == this_cpu);
 
 		if (cpu < nr_cpu_ids)
 			return cpu;

-- Steve

#3 lore raw

PATCH v2 1/1 sched/rt: Skip currently executing CPU in rto_next_cpu()

In reply to Steven Rostedt

CPU0 becomes overloaded when hosting a CPU-bound RT task, a non-CPU-bound RT task, and a CFS task stuck in kernel space. When other CPUs switch from RT to non-RT tasks, RT load balancing (LB) is triggered; with HAVE_RT_PUSH_IPI enabled, they send IPIs to CPU0 to drive the execution of rto_push_irq_work_func. During push_rt_task on CPU0,
if next_task->prio < rq->donor->prio, resched_curr() sets NEED_RESCHED and after the push operation completes, CPU0 calls rto_next_cpu(). Since only CPU0 is overloaded in this scenario, rto_next_cpu() should ideally return -1 (no further IPI needed).

However, multiple CPUs invoking tell_cpu_to_push() during LB increments rd->rto_loop_next. Even when rd->rto_cpu is set to -1, the mismatch between rd->rto_loop and rd->rto_loop_next forces rto_next_cpu() to restart its search from -1. With CPU0 remaining overloaded (satisfying rt_nr_migratory && rt_nr_total > 1), it gets reselected, causing CPU0 to queue irq_work to itself and send self-IPIs repeatedly. As long as CPU0 stays overloaded and other CPUs run pull_rt_tasks(), it falls into an infinite self-IPI loop, wasting CPU cycles on unnecessary interrupt handling.

The triggering scenario is as follows:

cpu0 cpu1 cpu2
pull_rt_task
tell_cpu_to_push
<------------irq_work_queue_on
rto_push_irq_work_func

       push_rt_task
    resched_curr(rq)                                      pull_rt_task
    rto_next_cpu                                        tell_cpu_to_push
     			 <-------------------------- atomic_inc(rto_loop_next)

rd->rto_loop != next
rto_next_cpu
irq_work_queue_on
rto_push_irq_work_func

Fix redundant self-IPI by filtering the initiating CPU in rto_next_cpu().

Fixes 4bdced5c9a292 ("sched/rt: Simplify the IPI based RT balancing logic")

---
v1-->v2:
- Replace the original "check NEED_RESCHED on target CPU" logic with "skip the currently executing CPU"
- This modification eliminates self-IPIS
---

---
 kernel/sched/rt.c | 12 ++++++++----
 1 file changed, 8 insertions(+), 4 deletions(-)
kernel/sched/rt.c +8 -4
index 7936d4333731..dc0d583aa59a 100644
@@ -2100,6 +2100,7 @@ static void push_rt_tasks(struct rq *rq)
  */
 static int rto_next_cpu(struct root_domain *rd)
 {
+	int this_cpu = smp_processor_id();
 	int next;
 	int cpu;
 
@@ -2118,14 +2119,17 @@ static int rto_next_cpu(struct root_domain *rd)
 	 */
 	for (;;) {
 
-		/* When rto_cpu is -1 this acts like cpumask_first() */
-		cpu = cpumask_next(rd->rto_cpu, rd->rto_mask);
-
-		rd->rto_cpu = cpu;
+		do {
+			/* When rto_cpu is -1 this acts like cpumask_first() */
+			cpu = cpumask_next(rd->rto_cpu, rd->rto_mask);
+			rd->rto_cpu = cpu;
+			/* Do not send IPI to self */
+		} while (cpu == this_cpu);
 
 		if (cpu < nr_cpu_ids)
 			return cpu;
 
+
 		rd->rto_cpu = -1;
 
 		/*
Signature · 1 line
2.34.1
reviewer Reviewed-by on v2 1/1
#4 lore raw

Re: [PATCH v2] sched/rt: Skip currently executing CPU in rto_next_cpu()

Quoted 66 lines · On Tue, 25 Nov 2025 08:36:49 +0000 Chen Jinghuang <[email protected]>…

CPU0 becomes overloaded when hosting a CPU-bound RT task, a non-CPU-bound RT task, and a CFS task stuck in kernel space. When other CPUs switch from RT to non-RT tasks, RT load balancing (LB) is triggered; with HAVE_RT_PUSH_IPI enabled, they send IPIs to CPU0 to drive the execution of rto_push_irq_work_func. During push_rt_task on CPU0,
if next_task->prio < rq->donor->prio, resched_curr() sets NEED_RESCHED and after the push operation completes, CPU0 calls rto_next_cpu(). Since only CPU0 is overloaded in this scenario, rto_next_cpu() should ideally return -1 (no further IPI needed).

However, multiple CPUs invoking tell_cpu_to_push() during LB increments rd->rto_loop_next. Even when rd->rto_cpu is set to -1, the mismatch between rd->rto_loop and rd->rto_loop_next forces rto_next_cpu() to restart its search from -1. With CPU0 remaining overloaded (satisfying rt_nr_migratory && rt_nr_total > 1), it gets reselected, causing CPU0 to queue irq_work to itself and send self-IPIs repeatedly. As long as CPU0 stays overloaded and other CPUs run pull_rt_tasks(), it falls into an infinite self-IPI loop, wasting CPU cycles on unnecessary interrupt handling.

The triggering scenario is as follows:

cpu0 cpu1 cpu2
pull_rt_task
tell_cpu_to_push
<------------irq_work_queue_on
rto_push_irq_work_func

       push_rt_task
    resched_curr(rq)                                      pull_rt_task
    rto_next_cpu                                        tell_cpu_to_push
     			 <-------------------------- atomic_inc(rto_loop_next)

rd->rto_loop != next
rto_next_cpu
irq_work_queue_on
rto_push_irq_work_func

Fix redundant self-IPI by filtering the initiating CPU in rto_next_cpu().

Fixes 4bdced5c9a292 ("sched/rt: Simplify the IPI based RT balancing logic")

---
v1-->v2:
- Replace the original "check NEED_RESCHED on target CPU" logic with "skip the currently executing CPU"
- This modification eliminates self-IPIS
---

---
 kernel/sched/rt.c | 12 ++++++++----
 1 file changed, 8 insertions(+), 4 deletions(-)
kernel/sched/rt.c +1 -0
index 7936d4333731..dc0d583aa59a 100644
@@ -2100,6 +2100,7 @@ static void push_rt_tasks(struct rq *rq)
  */
 static int rto_next_cpu(struct root_domain *rd)
 {
+	int this_cpu = smp_processor_id();
 	int next;
 	int cpu;
 
@@ -2118,14 +2119,17 @@ static int rto_next_cpu(struct root_domain *rd)
 	 */
 	for (;;) {
 

kernel/sched/rt.c static int rto_next_cpu(struct root_domain *rd) · line 2127

Quoted 10 lines
kernel/sched/rt.c +6 -4
-		/* When rto_cpu is -1 this acts like cpumask_first() */
-		cpu = cpumask_next(rd->rto_cpu, rd->rto_mask);
-
-		rd->rto_cpu = cpu;
+		do {
+			/* When rto_cpu is -1 this acts like cpumask_first() */
+			cpu = cpumask_next(rd->rto_cpu, rd->rto_mask);
+			rd->rto_cpu = cpu;
+			/* Do not send IPI to self */
+		} while (cpu == this_cpu);

So this fixes the issue you see too! Great!

kernel/sched/rt.c static int rto_next_cpu(struct root_domain *rd) · line 2132

Quoted 5 lines
kernel/sched/rt.c +1 -0
 		if (cpu < nr_cpu_ids)
 			return cpu;
 
+

Unneeded extra whitespace.

Other than that:

-- Steve

Quoted 3 lines
kernel/sched/rt.c +0 -0
 		rd->rto_cpu = -1;
 
 		/*
#5 lore raw

PATCH v3 1/1 sched/rt: Skip currently executing CPU in rto_next_cpu()

CPU0 becomes overloaded when hosting a CPU-bound RT task, a non-CPU-bound RT task, and a CFS task stuck in kernel space. When other CPUs switch from RT to non-RT tasks, RT load balancing (LB) is triggered; with HAVE_RT_PUSH_IPI enabled, they send IPIs to CPU0 to drive the execution of rto_push_irq_work_func. During push_rt_task on CPU0,
if next_task->prio < rq->donor->prio, resched_curr() sets NEED_RESCHED and after the push operation completes, CPU0 calls rto_next_cpu(). Since only CPU0 is overloaded in this scenario, rto_next_cpu() should ideally return -1 (no further IPI needed).

However, multiple CPUs invoking tell_cpu_to_push() during LB increments rd->rto_loop_next. Even when rd->rto_cpu is set to -1, the mismatch between rd->rto_loop and rd->rto_loop_next forces rto_next_cpu() to restart its search from -1. With CPU0 remaining overloaded (satisfying rt_nr_migratory && rt_nr_total > 1), it gets reselected, causing CPU0 to queue irq_work to itself and send self-IPIs repeatedly. As long as CPU0 stays overloaded and other CPUs run pull_rt_tasks(), it falls into an infinite self-IPI loop, wasting CPU cycles on unnecessary interrupt handling.

The triggering scenario is as follows:

cpu0 cpu1 cpu2
pull_rt_task
tell_cpu_to_push
<------------irq_work_queue_on
rto_push_irq_work_func

       push_rt_task
    resched_curr(rq)                                      pull_rt_task
    rto_next_cpu                                        tell_cpu_to_push
     			 <-------------------------- atomic_inc(rto_loop_next)

rd->rto_loop != next
rto_next_cpu
irq_work_queue_on
rto_push_irq_work_func

Fix redundant self-IPI by filtering the initiating CPU in rto_next_cpu().

Fixes 4bdced5c9a292 ("sched/rt: Simplify the IPI based RT balancing logic")

---
v1-->v2:
- Replace the original "check NEED_RESCHED on target CPU" logic with "skip the currently executing CPU"
- This modification eliminates self-IPIS v2-->v3:
- Remove unneeded extra whitespace
- Add Reviewed-by tag from Steven Rostedt
---

---
 kernel/sched/rt.c | 11 +++++++----
 1 file changed, 7 insertions(+), 4 deletions(-)
kernel/sched/rt.c +7 -4
index 7936d4333731..f6af41e27508 100644
@@ -2100,6 +2100,7 @@ static void push_rt_tasks(struct rq *rq)
  */
 static int rto_next_cpu(struct root_domain *rd)
 {
+	int this_cpu = smp_processor_id();
 	int next;
 	int cpu;
 
@@ -2118,10 +2119,12 @@ static int rto_next_cpu(struct root_domain *rd)
 	 */
 	for (;;) {
 
-		/* When rto_cpu is -1 this acts like cpumask_first() */
-		cpu = cpumask_next(rd->rto_cpu, rd->rto_mask);
-
-		rd->rto_cpu = cpu;
+		do {
+			/* When rto_cpu is -1 this acts like cpumask_first() */
+			cpu = cpumask_next(rd->rto_cpu, rd->rto_mask);
+			rd->rto_cpu = cpu;
+			/* Do not send IPI to self */
+		} while (cpu == this_cpu);
 
 		if (cpu < nr_cpu_ids)
 			return cpu;
Signature · 1 line
2.34.1
#6 lore raw

PATCH v3 1/1 sched/rt: Skip currently executing CPU in rto_next_cpu() - Request for merge

In reply to Steven Rostedt

Hi Steven Rostedt,

This is a follow-up on my v3 patch for sched/rt: "Skip currently executing CPU in rto_next_cpu()" (archive link:
https://lore.kernel.org/lkml/[email protected]/)

You previously confirmed that this patch resolves the issue of a CPU sending an IPI to itself. This patch has also fully resolved the issue I encountered in my testing environment. Could you please help merge this v3 patch into mainline? I'm happy to address any code review.

Thanks a lot for your time and review!

reviewer Reviewed-by on v3 1/1
#7 lore raw

Re: [PATCH v3] sched/rt: Skip currently executing CPU in rto_next_cpu() - Request for merge

Quoted 8 lines · On Thu, 4 Dec 2025 07:35:44 +0000 Chen Jinghuang <[email protected]>…

Hi Steven Rostedt,

This is a follow-up on my v3 patch for sched/rt: "Skip currently executing CPU in rto_next_cpu()" (archive link:
https://lore.kernel.org/lkml/[email protected]/)

You previously confirmed that this patch resolves the issue of a CPU sending an IPI to itself. This patch has also fully resolved the issue

I didn't confirm it resolved the issue. I just said it looks like it would. I'm not the one that found the bug. I would assume the one that found this issue tested this new patch and confirmed that it passed.

Quoted 4 lines

I encountered in my testing environment. Could you please help merge this v3 patch into mainline? I'm happy to address any code review.

Thanks a lot for your time and review!

I already gave my reviewed-by tag. It's Peter Zijlstra that needs to accept it. I'm only a reviewer and not one of the scheduling maintainers.

One issue you have here is that you are replying to the previous patch with a new patch. That's not how it works. A new patch must be a start of a new thread. Otherwise it gets very confusing for the maintainer, and most of the time, maintainers miss these new patches embedded into threads of old patches.

What you should also do is reference the lore link in your "changes" portion after the '---'. For example, v3 should have been a new thread with the following:

Fixes 4bdced5c9a292 ("sched/rt: Simplify the IPI based RT balancing logic")

---
Changes since v2: https://lore.kernel.org/all/[email protected]/

- Replace the original "check NEED_RESCHED on target CPU" logic with "skip the currently executing CPU"
- This modification eliminates self-IPIS

And the patch of v2 should have had:

Changes since v1: https://lore.kernel.org/all/[email protected]/
- Remove unneeded extra whitespace
- Add Reviewed-by tag from Steven Rostedt

And that allows people to find the previous version of the patch without having the new version be a reply to it.

-- Steve