From: Dietmar Eggemann <dietmar.eggemann@arm.com>
To: Schspa Shi <schspa@gmail.com>
Cc: mingo@redhat.com, peterz@infradead.org, juri.lelli@redhat.com,
vincent.guittot@linaro.org, rostedt@goodmis.org,
bsegall@google.com, mgorman@suse.de, bristot@redhat.com,
vschneid@redhat.com, linux-kernel@vger.kernel.org
Subject: Re: [PATCH v6 1/2] sched/rt: fix bad task migration for rt tasks
Date: Wed, 13 Jul 2022 11:43:57 +0200 [thread overview]
Message-ID: <76169a43-cda0-177a-2b1f-7dcdad900935@arm.com> (raw)
In-Reply-To: <m2h73me3nk.fsf@gmail.com>
On 12/07/2022 17:35, Schspa Shi wrote:
>
> Dietmar Eggemann <dietmar.eggemann@arm.com> writes:
>
>> On 12/07/2022 17:05, Schspa Shi wrote:
[...]
>> What code-base is this?
>
> This is the logs from 5.10.59-rt
> Link: https://git.kernel.org/pub/scm/linux/kernel/git/rt/linux-stable-rt.git
> v5.10.59-rt52 (9007b684f615750b0ee4ec57b5e547a4bf4a223e).
Thanks.
>> IMHO, currently this `WARN_ON_ONCE(is_migration_disabled(p))` in
>> set_task_cpu() is at > line 3000.
>>
>
> But the master code have this BUG too.
I see. It's just that need_to_push in task_woken_rt() triggers
push_rt_tasks() much more often on preempt-rt.
[...]
>>> diff --git a/kernel/sched/rt.c b/kernel/sched/rt.c
>>> index 8c9ed96648409..7bd3e6ecbe45e 100644
>>> --- a/kernel/sched/rt.c
>>> +++ b/kernel/sched/rt.c
>>> @@ -1998,11 +1998,15 @@ static struct rq *find_lock_lowest_rq(struct task_struct *task, struct rq *rq)
>>> * the mean time, task could have
>>> * migrated already or had its affinity changed.
>>> * Also make sure that it wasn't scheduled on its rq.
>>> + * It is possible the task was scheduled, set
>>> + * "migrate_disabled" and then got preempted, so we must
>>> + * check the task migration disable flag here too.
>>> */
>>> if (unlikely(task_rq(task) != rq ||
>>> !cpumask_test_cpu(lowest_rq->cpu, &task->cpus_mask) ||
>>> task_running(rq, task) ||
>>> !rt_task(task) ||
>>> + is_migration_disabled(task) ||
>>
>> I wonder why this isn't covered by `task_rq(task) != rq` in this condition?
>>
>
> It's because thie task is not migrated, it just get scheduled and
> calling migrate_disable(); and then got preempted by it's CPU core
> before enable migrate_enable(). the task_rq not changed in this
> scenarios.
Yes, get it now. Essentially we need `current CPU (CPU0) != rq->cpu
(CPU1)`. Now I see that you had the discussion with Steven already on v3 ;-)
prev parent reply other threads:[~2022-07-13 9:44 UTC|newest]
Thread overview: 9+ messages / expand[flat|nested] mbox.gz Atom feed top
2022-07-12 15:05 Schspa Shi
2022-07-12 15:05 ` [PATCH v6 2/2] sched/rt: Trying to push current task when target disable migrating Schspa Shi
2022-07-12 15:17 ` Steven Rostedt
2022-07-13 10:02 ` Dietmar Eggemann
2022-07-13 12:24 ` Schspa Shi
2022-07-12 15:16 ` [PATCH v6 1/2] sched/rt: fix bad task migration for rt tasks Steven Rostedt
2022-07-12 15:26 ` Dietmar Eggemann
2022-07-12 15:35 ` Schspa Shi
2022-07-13 9:43 ` Dietmar Eggemann [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=76169a43-cda0-177a-2b1f-7dcdad900935@arm.com \
--to=dietmar.eggemann@arm.com \
--cc=bristot@redhat.com \
--cc=bsegall@google.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=schspa@gmail.com \
--cc=vincent.guittot@linaro.org \
--cc=vschneid@redhat.com \
/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®