From: Peter Zijlstra <peterz@infradead.org>
To: Valentin Schneider <valentin.schneider@arm.com>
Cc: linux-kernel@vger.kernel.org, Will Deacon <will@kernel.org>,
Ingo Molnar <mingo@kernel.org>,
Morten Rasmussen <morten.rasmussen@arm.com>,
Qais Yousef <qais.yousef@arm.com>,
Dietmar Eggemann <dietmar.eggemann@arm.com>,
Quentin Perret <qperret@google.com>,
Juri Lelli <juri.lelli@redhat.com>,
Vincent Guittot <vincent.guittot@linaro.org>,
kernel-team@android.com
Subject: Re: [PATCH 2/2] sched: Plug race between SCA, hotplug and migration_cpu_stop()
Date: Thu, 27 May 2021 11:12:22 +0200 [thread overview]
Message-ID: <YK9idgafP4G/ECme@hirez.programming.kicks-ass.net> (raw)
In-Reply-To: <20210526205751.842360-3-valentin.schneider@arm.com>
On Wed, May 26, 2021 at 09:57:51PM +0100, Valentin Schneider wrote:
> - rq = __migrate_task(rq, &rf, p, arg->dest_cpu);
Suggests we ought to at the very least include something like the below.
/me continues reading...
--- a/kernel/sched/core.c
+++ b/kernel/sched/core.c
@@ -2246,28 +2246,6 @@ struct set_affinity_pending {
struct migration_arg arg;
};
-/*
- * Move (not current) task off this CPU, onto the destination CPU. We're doing
- * this because either it can't run here any more (set_cpus_allowed()
- * away from this CPU, or CPU going down), or because we're
- * attempting to rebalance this task on exec (sched_exec).
- *
- * So we race with normal scheduler movements, but that's OK, as long
- * as the task is no longer on this CPU.
- */
-static struct rq *__migrate_task(struct rq *rq, struct rq_flags *rf,
- struct task_struct *p, int dest_cpu)
-{
- /* Affinity changed (again). */
- if (!is_cpu_allowed(p, dest_cpu))
- return rq;
-
- update_rq_clock(rq);
- rq = move_queued_task(rq, rf, p, dest_cpu);
-
- return rq;
-}
-
static int select_fallback_rq(int cpu, struct task_struct *p);
/*
@@ -2292,7 +2270,7 @@ static int migration_cpu_stop(void *data
local_irq_save(rf.flags);
/*
* We need to explicitly wake pending tasks before running
- * __migrate_task() such that we will not miss enforcing cpus_ptr
+ * move_queued_task() such that we will not miss enforcing cpus_ptr
* during wakeups, see set_cpus_allowed_ptr()'s TASK_WAKING test.
*/
flush_smp_call_function_from_idle();
@@ -8463,7 +8441,7 @@ static int __balance_push_cpu_stop(void
if (task_rq(p) == rq && task_on_rq_queued(p)) {
cpu = select_fallback_rq(rq->cpu, p);
- rq = __migrate_task(rq, &rf, p, cpu);
+ rq = move_queued_task(rq, &rf, p, cpu);
}
rq_unlock(rq, &rf);
next prev parent reply other threads:[~2021-05-27 9:12 UTC|newest]
Thread overview: 10+ messages / expand[flat|nested] mbox.gz Atom feed top
2021-05-26 20:57 [PATCH 0/2] sched: SCA vs hotplug vs stopper races fixes Valentin Schneider
2021-05-26 20:57 ` [PATCH 1/2] sched: Don't defer CPU pick to migration_cpu_stop() Valentin Schneider
2021-06-01 14:04 ` [tip: sched/core] " tip-bot2 for Valentin Schneider
2021-05-26 20:57 ` [PATCH 2/2] sched: Plug race between SCA, hotplug and migration_cpu_stop() Valentin Schneider
2021-05-27 9:12 ` Peter Zijlstra [this message]
2021-06-01 16:59 ` Valentin Schneider
2021-06-02 15:26 ` Will Deacon
2021-06-02 19:43 ` Valentin Schneider
2021-06-22 13:51 ` Will Deacon
2021-06-24 9:33 ` Valentin Schneider
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=YK9idgafP4G/ECme@hirez.programming.kicks-ass.net \
--to=peterz@infradead.org \
--cc=dietmar.eggemann@arm.com \
--cc=juri.lelli@redhat.com \
--cc=kernel-team@android.com \
--cc=linux-kernel@vger.kernel.org \
--cc=mingo@kernel.org \
--cc=morten.rasmussen@arm.com \
--cc=qais.yousef@arm.com \
--cc=qperret@google.com \
--cc=valentin.schneider@arm.com \
--cc=vincent.guittot@linaro.org \
--cc=will@kernel.org \
--subject='Re: [PATCH 2/2] sched: Plug race between SCA, hotplug and migration_cpu_stop()' \
/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
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.