mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: Valentin Schneider <vschneid@redhat.com>
To: Sebastian Andrzej Siewior <bigeasy@linutronix.de>
Cc: linux-kernel@vger.kernel.org, Ben Segall <bsegall@google.com>,
	Daniel Bristot de Oliveira <bristot@redhat.com>,
	Dietmar Eggemann <dietmar.eggemann@arm.com>,
	Ingo Molnar <mingo@redhat.com>,
	Juri Lelli <juri.lelli@redhat.com>, Mel Gorman <mgorman@suse.de>,
	Peter Zijlstra <peterz@infradead.org>,
	Steven Rostedt <rostedt@goodmis.org>,
	Vincent Guittot <vincent.guittot@linaro.org>,
	Thomas Gleixner <tglx@linutronix.de>
Subject: Re: [PATCH] sched/rt: Don't try push tasks if there are none.
Date: Thu, 10 Aug 2023 10:09:23 +0100	[thread overview]
Message-ID: <xhsmhpm3vb6ws.mognet@vschneid.remote.csb> (raw)
In-Reply-To: <20230810080708.L4nV_aKI@linutronix.de>

On 10/08/23 10:07, Sebastian Andrzej Siewior wrote:
> On 2023-08-09 18:02:32 [+0100], Valentin Schneider wrote:
>> On 01/08/23 17:26, Sebastian Andrzej Siewior wrote:
>> > I have a RT task X at a high priority and cyclictest on each CPU with
>> > lower priority than X's. If X is active and each CPU wakes their own
>> > cylictest thread then it ends in a longer rto_push storm.
>> > A random CPU determines via balance_rt() that the CPU on which X is
>> > running needs to push tasks. X has the highest priority, cyclictest is
>> > next in line so there is nothing that can be done since the task with
>> > the higher priority is not touched.
>> >
>> > tell_cpu_to_push() increments rto_loop_next and schedules
>> > rto_push_irq_work_func() on X's CPU. The other CPUs also increment the
>> > loop counter and do the same. Once rto_push_irq_work_func() is active it
>> > does nothing because it has _no_ pushable tasks on its runqueue. Then
>> > checks rto_next_cpu() and decides to queue irq_work on the local CPU
>> > because another CPU requested a push by incrementing the counter.
>> >
>>
>> For a CPU to be in the rto_mask, it needs:
>>
>>   rt_rq->rt_nr_migratory && rt_rq->rt_nr_total > 1
>>
>> But if that CPU has no pushable tasks, then that means only the current
>> task has p->nr_cpus_allowed > 1.
>>
>> Should we change it so a CPU is only in the rto_mask iff it has pushable
>> tasks? AFAICT that should not break the case where we push the current task
>> away due to migration_disabled, as that still relies on the
>> migration_disabled task to be in the pushable list.
>
> Sounds good. The task with the highest priority becomes pushable if it
> gets preempted (by a task with higher priority). This gets considered,
> right?
>

Yeah, when we switch the current task in put_prev_task_rt() we add the
previously-running (IOW preempted) task to the pushable list (if isn't
affined to just one CPU).

Now it looks like if we change update_rt_migration() to look at the
pushable list instead of rt_nr_migratory, we could get rid of
rt_nr_migratory itself - let me poke at this a little, I might just be
about to figure out why that isn't already the case...

> Sebastian


      reply	other threads:[~2023-08-10  9:10 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2023-08-01 15:26 Sebastian Andrzej Siewior
2023-08-01 16:00 ` Steven Rostedt
2023-08-09 17:02 ` Valentin Schneider
2023-08-10  8:07   ` Sebastian Andrzej Siewior
2023-08-10  9:09     ` Valentin Schneider [this message]

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=xhsmhpm3vb6ws.mognet@vschneid.remote.csb \
    --to=vschneid@redhat.com \
    --cc=bigeasy@linutronix.de \
    --cc=bristot@redhat.com \
    --cc=bsegall@google.com \
    --cc=dietmar.eggemann@arm.com \
    --cc=juri.lelli@redhat.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=mgorman@suse.de \
    --cc=mingo@redhat.com \
    --cc=peterz@infradead.org \
    --cc=rostedt@goodmis.org \
    --cc=tglx@linutronix.de \
    --cc=vincent.guittot@linaro.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®