mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: Waiman Long <longman@redhat.com>
To: Tejun Heo <tj@kernel.org>
Cc: Ingo Molnar <mingo@redhat.com>,
	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>,
	Daniel Bristot de Oliveira <bristot@redhat.com>,
	Valentin Schneider <vschneid@redhat.com>,
	Will Deacon <will@kernel.org>, Phil Auld <pauld@redhat.com>,
	linux-kernel@vger.kernel.org
Subject: Re: [PATCH] sched/core: Fix a missed update of user_cpus_ptr
Date: Fri, 3 Feb 2023 17:13:02 -0500	[thread overview]
Message-ID: <820b04a1-8c2f-ba81-f508-5750c63f3239@redhat.com> (raw)
In-Reply-To: <Y9128uN5X8L3VTG3@slm.duckdns.org>

On 2/3/23 16:04, Tejun Heo wrote:
> On Fri, Feb 03, 2023 at 01:18:49PM -0500, Waiman Long wrote:
>> Since commit 8f9ea86fdf99 ("sched: Always preserve the user requested
>> cpumask"), a successful call to sched_setaffinity() should always save
>> the user requested cpu affinity mask in a task's user_cpus_ptr. However,
>> when the given cpu mask is the same as the current one, user_cpus_ptr
>> is not updated. Fix this by saving the user mask in this case too.
>>
>> Fixes: 8f9ea86fdf99 ("sched: Always preserve the user requested cpumask")
>> Signed-off-by: Waiman Long <longman@redhat.com>
>> ---
>>   kernel/sched/core.c | 5 ++++-
>>   1 file changed, 4 insertions(+), 1 deletion(-)
>>
>> diff --git a/kernel/sched/core.c b/kernel/sched/core.c
>> index 30d9752e2ca5..91255f791df3 100644
>> --- a/kernel/sched/core.c
>> +++ b/kernel/sched/core.c
>> @@ -2951,8 +2951,11 @@ static int __set_cpus_allowed_ptr_locked(struct task_struct *p,
>>   	}
>>   
>>   	if (!(ctx->flags & SCA_MIGRATE_ENABLE)) {
>> -		if (cpumask_equal(&p->cpus_mask, ctx->new_mask))
>> +		if (cpumask_equal(&p->cpus_mask, ctx->new_mask)) {
>> +			if (ctx->flags & SCA_USER)
>> +				swap(p->user_cpus_ptr, ctx->user_mask);
>>   			goto out;
>> +		}
>>   
>>   		if (WARN_ON_ONCE(p == current &&
>>   				 is_migration_disabled(p) &&
> and this is for a separate bug and should go through the scheduler tree.

Yes, this is for Peter to pick up.

Cheers,
Longman


  reply	other threads:[~2023-02-03 22:15 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2023-02-03 18:18 Waiman Long
2023-02-03 21:04 ` Tejun Heo
2023-02-03 22:13   ` Waiman Long [this message]
2023-02-13 14:56 ` Peter Zijlstra
2023-02-15 10:33 ` [tip: sched/urgent] " tip-bot2 for Waiman Long

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=820b04a1-8c2f-ba81-f508-5750c63f3239@redhat.com \
    --to=longman@redhat.com \
    --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=pauld@redhat.com \
    --cc=peterz@infradead.org \
    --cc=rostedt@goodmis.org \
    --cc=tj@kernel.org \
    --cc=vincent.guittot@linaro.org \
    --cc=vschneid@redhat.com \
    --cc=will@kernel.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®