From: Peter Zijlstra <peterz@infradead.org>
To: Ingo Molnar <mingo@kernel.org>, Thomas Gleixner <tglx@linutronix.de>
Cc: Valentin Schneider <valentin.schneider@arm.com>,
Vincent Guittot <vincent.guittot@linaro.org>,
Mel Gorman <mgorman@suse.de>,
Dietmar Eggemann <dietmar.eggemann@arm.com>,
linux-kernel@vger.kernel.org, Andi Kleen <andi@firstfloor.org>
Subject: Re: [PATCH 6/6] sched: Simplify set_affinity_pending refcounts
Date: Wed, 24 Feb 2021 16:34:58 +0100 [thread overview]
Message-ID: <YDZyIugiyxAq0tVz@hirez.programming.kicks-ass.net> (raw)
In-Reply-To: <20210224131355.724130207@infradead.org>
On Wed, Feb 24, 2021 at 01:24:45PM +0100, Peter Zijlstra wrote:
> @@ -2199,12 +2199,16 @@ static int affine_move_task(struct rq *r
> push_task = get_task_struct(p);
> }
>
> + /*
> + * If there are pending waiters, but no pending stop_work,
> + * then complete now.
> + */
> pending = p->migration_pending;
> + if (pending && !pending->stop_pending) {
> p->migration_pending = NULL;
> complete = true;
> }
> @@ -2282,12 +2286,13 @@ static int affine_move_task(struct rq *r
> if (task_on_rq_queued(p))
> rq = move_queued_task(rq, rf, p, dest_cpu);
>
> + if (!pending->stop_pending) {
> + p->migration_pending = NULL;
> + complete = true;
> + }
> }
> task_rq_unlock(rq, p, rf);
Elsewhere Valentin argued something like the below ought to be possible.
I've not drawn diagrams yet, but if I understood his argument right it
should be possible.
---
diff --git a/kernel/sched/core.c b/kernel/sched/core.c
index 1c56ac4df2c9..3ffbd1b76f3e 100644
--- a/kernel/sched/core.c
+++ b/kernel/sched/core.c
@@ -2204,9 +2204,10 @@ static int affine_move_task(struct rq *rq, struct task_struct *p, struct rq_flag
* then complete now.
*/
pending = p->migration_pending;
- if (pending && !pending->stop_pending) {
+ if (pending) {
p->migration_pending = NULL;
- complete = true;
+ if (!pending->stop_pending)
+ complete = true;
}
task_rq_unlock(rq, p, rf);
@@ -2286,10 +2287,9 @@ static int affine_move_task(struct rq *rq, struct task_struct *p, struct rq_flag
if (task_on_rq_queued(p))
rq = move_queued_task(rq, rf, p, dest_cpu);
- if (!pending->stop_pending) {
- p->migration_pending = NULL;
+ p->migration_pending = NULL;
+ if (!pending->stop_pending)
complete = true;
- }
}
task_rq_unlock(rq, p, rf);
next prev parent reply other threads:[~2021-02-24 15:49 UTC|newest]
Thread overview: 27+ messages / expand[flat|nested] mbox.gz Atom feed top
2021-02-24 12:24 [PATCH 0/6] sched: Fix affine_move_task() wreckage Peter Zijlstra
2021-02-24 12:24 ` [PATCH 1/6] sched: Fix migration_cpu_stop() requeueing Peter Zijlstra
2021-03-01 10:16 ` [tip: sched/urgent] " tip-bot2 for Peter Zijlstra
2021-03-06 11:42 ` [tip: sched/core] " tip-bot2 for Peter Zijlstra
2021-02-24 12:24 ` [PATCH 2/6] sched: Simplify migration_cpu_stop() Peter Zijlstra
2021-02-24 15:34 ` Valentin Schneider
2021-02-25 8:45 ` Peter Zijlstra
2021-02-25 11:10 ` Valentin Schneider
2021-03-01 10:16 ` [tip: sched/urgent] " tip-bot2 for Peter Zijlstra
2021-03-06 11:42 ` [tip: sched/core] " tip-bot2 for Peter Zijlstra
2021-02-24 12:24 ` [PATCH 3/6] sched: Collate affine_move_task() stoppers Peter Zijlstra
2021-03-01 10:16 ` [tip: sched/urgent] " tip-bot2 for Peter Zijlstra
2021-03-06 11:42 ` [tip: sched/core] " tip-bot2 for Peter Zijlstra
2021-02-24 12:24 ` [PATCH 4/6] sched: Optimize migration_cpu_stop() Peter Zijlstra
2021-03-01 10:16 ` [tip: sched/urgent] " tip-bot2 for Peter Zijlstra
2021-03-06 11:42 ` [tip: sched/core] " tip-bot2 for Peter Zijlstra
2021-02-24 12:24 ` [PATCH 5/6] sched: Fix affine_move_task() self-concurrency Peter Zijlstra
2021-03-01 10:16 ` [tip: sched/urgent] " tip-bot2 for Peter Zijlstra
2021-03-06 11:42 ` [tip: sched/core] " tip-bot2 for Peter Zijlstra
2021-02-24 12:24 ` [PATCH 6/6] sched: Simplify set_affinity_pending refcounts Peter Zijlstra
2021-02-24 15:34 ` Valentin Schneider
2021-02-24 15:34 ` Peter Zijlstra [this message]
2021-02-24 17:59 ` Valentin Schneider
2021-02-25 9:27 ` Peter Zijlstra
2021-02-25 11:11 ` Valentin Schneider
2021-03-01 10:16 ` [tip: sched/urgent] " tip-bot2 for Peter Zijlstra
2021-03-06 11:42 ` [tip: sched/core] " tip-bot2 for Peter Zijlstra
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=YDZyIugiyxAq0tVz@hirez.programming.kicks-ass.net \
--to=peterz@infradead.org \
--cc=andi@firstfloor.org \
--cc=dietmar.eggemann@arm.com \
--cc=linux-kernel@vger.kernel.org \
--cc=mgorman@suse.de \
--cc=mingo@kernel.org \
--cc=tglx@linutronix.de \
--cc=valentin.schneider@arm.com \
--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;
as well as URLs for NNTP newsgroup(s).