Re: [PATCH] sched/rt: Use cpu_active_mask to prevent rto_push_irq_work's dead loop

From: Steven Rostedt
Date: Sun Nov 20 2022 - 14:27:52 EST


On Fri, 18 Nov 2022 20:08:54 +0800
Xuewen Yan <xuewen.yan94@xxxxxxxxx> wrote:

> Let's consider this scenario:
> the online_cpu_mask is 0x03(cpu0/1),the active_cpu_mask is
> 0x01(cpu0),the rto cpu is cpu0,
> the rto_mask is 0x01, and the irq cpu is cpu0, as a result, the first
> loop, the rto_cpu would be -1,
> but the loop < rto_loop_next, on next loop, because of the rto_cpu is
> -1, so the next rto cpu would
> be cpu0 still, as a result, the cpu0 would push rt tasks to
> cpu1(inactive cpu) while running in the irq_work.
>
> So we should judge whether the current cpu(the only one active cpu) is
> the next loop's cpu.

Wait, I'm confused by what you are trying to do here.

The rto_next_cpu() only sends an IPI to the next CPU that has more than
one RT task queued on it, where the RT tasks can migrate.

If we send CPU0 an IPI, let CPU0 figure out to only push to the active
mask. Why are trying to prevent sending the IPI to an active CPU?

Will the first part of your patch that modifies the cpupri() not keep
it from pushing to the non active CPU?

-- Steve