From: Valentin Schneider <valentin.schneider@arm.com>
To: Sebastian Andrzej Siewior <bigeasy@linutronix.de>
Cc: linux-kernel@vger.kernel.org, Ingo Molnar <mingo@kernel.org>,
Peter Zijlstra <peterz@infradead.org>,
Juri Lelli <juri.lelli@redhat.com>,
Vincent Guittot <vincent.guittot@linaro.org>,
Dietmar Eggemann <dietmar.eggemann@arm.com>,
Steven Rostedt <rostedt@goodmis.org>,
Ben Segall <bsegall@google.com>, Mel Gorman <mgorman@suse.de>,
Thomas Gleixner <tglx@linutronix.de>,
Scott Wood <swood@redhat.com>
Subject: Re: [PATCH] sched: __set_cpus_allowed_ptr(): Check cpus_mask, not cpus_ptr
Date: Wed, 17 Jun 2020 15:15:31 +0100 [thread overview]
Message-ID: <jhjmu51eq2k.mognet@arm.com> (raw)
In-Reply-To: <20200617121742.cpxppyi7twxmpin7@linutronix.de>
On 17/06/20 13:17, Sebastian Andrzej Siewior wrote:
> From: Scott Wood <swood@redhat.com>
>
> This function is concerned with the long-term cpu mask, not the
> transitory mask the task might have while migrate disabled. Before
> this patch, if a task was migrate disabled at the time
> __set_cpus_allowed_ptr() was called, and the new mask happened to be
> equal to the cpu that the task was running on, then the mask update
> would be lost.
>
> Signed-off-by: Scott Wood <swood@redhat.com>
> Signed-off-by: Sebastian Andrzej Siewior <bigeasy@linutronix.de>
> ---
> kernel/sched/core.c | 2 +-
> 1 file changed, 1 insertion(+), 1 deletion(-)
>
> --- a/kernel/sched/core.c
> +++ b/kernel/sched/core.c
> @@ -1637,7 +1637,7 @@ static int __set_cpus_allowed_ptr(struct
> goto out;
> }
>
> - if (cpumask_equal(p->cpus_ptr, new_mask))
> + if (cpumask_equal(&p->cpus_mask, new_mask))
> goto out;
>
> /*
Makes sense, but what about the rest of the checks? Further down there is
/* Can the task run on the task's current CPU? If so, we're done */
if (cpumask_test_cpu(task_cpu(p), new_mask))
goto out;
If the task is currently migrate disabled and for some stupid reason it
gets affined elsewhere, we could try to move it out - which AFAICT we don't
want to do because migrate disabled. So I suppose you'd want an extra
bailout condition here when the task is migrate disabled.
ISTR in RT you do re-check the affinity and potentially move the task away
when re-enabling migration, so that should work out all fine.
next prev parent reply other threads:[~2020-06-17 14:15 UTC|newest]
Thread overview: 7+ messages / expand[flat|nested] mbox.gz Atom feed top
2020-06-17 12:17 [PATCH] sched: __set_cpus_allowed_ptr(): Check cpus_mask, not cpus_ptr Sebastian Andrzej Siewior
2020-06-17 14:15 ` Valentin Schneider [this message]
2020-06-17 22:49 ` Scott Wood
2020-06-18 8:07 ` Sebastian Andrzej Siewior
2020-06-18 8:51 ` Valentin Schneider
2020-06-23 7:19 ` [tip: sched/urgent] " tip-bot2 for Scott Wood
2020-06-23 8:48 ` [tip: sched/urgent] sched/core: Check cpus_mask, not cpus_ptr in __set_cpus_allowed_ptr(), to fix mask corruption tip-bot2 for Scott Wood
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=jhjmu51eq2k.mognet@arm.com \
--to=valentin.schneider@arm.com \
--cc=bigeasy@linutronix.de \
--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@kernel.org \
--cc=peterz@infradead.org \
--cc=rostedt@goodmis.org \
--cc=swood@redhat.com \
--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