mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: Tadeusz Struk <tadeusz.struk@linaro.org>
To: Vincent Guittot <vincent.guittot@linaro.org>,
	Daniel Jordan <daniel.m.jordan@oracle.com>
Cc: peterz@infradead.org, Ingo Molnar <mingo@redhat.com>,
	Juri Lelli <juri.lelli@redhat.com>,
	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>,
	Zhang Qiao <zhangqiao22@huawei.com>,
	stable@vger.kernel.org, linux-kernel@vger.kernel.org,
	syzbot+af7a719bc92395ee41b3@syzkaller.appspotmail.com
Subject: Re: [PATCH v2] sched/fair: Fix fault in reweight_entity
Date: Tue, 25 Jan 2022 10:59:15 -0800	[thread overview]
Message-ID: <8ab3272f-38b3-b7e9-abab-72a03ec0c872@linaro.org> (raw)
In-Reply-To: <8eaaffe1-f6aa-4d8f-bbc7-0a57002d1729@linaro.org>

On 1/25/22 10:30, Tadeusz Struk wrote:
> On 1/25/22 01:14, Vincent Guittot wrote:
>> Could we use :
>> set_load_weight(p, !(p->__state & TASK_NEW));
>> instead of
>> set_load_weight(p, true);
>> in set_user_nice and __setscheduler_params.
> 
> Wouldn't that require READ_ONCE() and rmb() after the read?

diff --git a/kernel/sched/core.c b/kernel/sched/core.c
index 848eaa0efe0e..3d7ede06b971 100644
--- a/kernel/sched/core.c
+++ b/kernel/sched/core.c
@@ -6921,7 +6921,7 @@ void set_user_nice(struct task_struct *p, long nice)
                 put_prev_task(rq, p);

         p->static_prio = NICE_TO_PRIO(nice);
-       set_load_weight(p, true);
+       set_load_weight(p, !(READ_ONCE(p->__state) & TASK_NEW));
         old_prio = p->prio;
         p->prio = effective_prio(p);

That works for me. I will send a new version soon.

-- 
Thanks,
Tadeusz

      reply	other threads:[~2022-01-25 18:59 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-01-20 20:01 Tadeusz Struk
2022-01-25  1:18 ` Daniel Jordan
2022-01-25  9:14   ` Vincent Guittot
2022-01-25 18:30     ` Tadeusz Struk
2022-01-25 18:59       ` Tadeusz Struk [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=8ab3272f-38b3-b7e9-abab-72a03ec0c872@linaro.org \
    --to=tadeusz.struk@linaro.org \
    --cc=bristot@redhat.com \
    --cc=bsegall@google.com \
    --cc=daniel.m.jordan@oracle.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=peterz@infradead.org \
    --cc=rostedt@goodmis.org \
    --cc=stable@vger.kernel.org \
    --cc=syzbot+af7a719bc92395ee41b3@syzkaller.appspotmail.com \
    --cc=vincent.guittot@linaro.org \
    --cc=zhangqiao22@huawei.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®