linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Dietmar Eggemann <dietmar.eggemann@arm.com>
To: Quentin Perret <qperret@google.com>,
	Ingo Molnar <mingo@redhat.com>,
	Peter Zijlstra <peterz@infradead.org>,
	Juri Lelli <juri.lelli@redhat.com>,
	Vincent Guittot <vincent.guittot@linaro.org>,
	Steven Rostedt <rostedt@goodmis.org>,
	Ben Segall <bsegall@google.com>, Mel Gorman <mgorman@suse.de>,
	Daniel Bristot de Oliveira <bristot@redhat.com>,
	linux-kernel@vger.kernel.org
Subject: Re: [PATCH 1/2] sched/deadline: Fix reset_on_fork reporting of DL tasks
Date: Thu, 29 Jul 2021 18:26:40 +0200	[thread overview]
Message-ID: <e6d103f1-f8ee-cad9-c7c0-c9ea5d0f099a@arm.com> (raw)
In-Reply-To: <20210727101103.2729607-2-qperret@google.com>

On 27/07/2021 12:11, Quentin Perret wrote:
> It is possible for sched_getattr() to incorrectly report the state of
> the reset_on_fork flag when called on a deadline task.
> 
> Indeed, if the flag was set on a deadline task using sched_setattr()
> with flags (SCHED_FLAG_RESET_ON_FORK | SCHED_FLAG_KEEP_PARAMS), then
> p->sched_reset_on_fork will be set, but __setscheduler() will bail out
> early, which means that the dl_se->flags will not get updated by
> __setscheduler_params()->__setparam_dl(). Consequently, if

True, but it would also be awkward if non-DL related flags would have to
be stored in dl_se->flags.

> sched_getattr() is then called on the task, __getparam_dl() will
> override kattr.sched_flags with the now out-of-date copy in dl_se->flags
> and report the stale value to userspace.
> 
> To fix this, make sure to only copy the flags that are relevant to
> sched_deadline to and from the dl_se->flags field.

It also fixes the 'hidden' issue that a

    uclampset -mX -MY -p dl_task

would end up at 'change:' label because of

    dl_se->flags != attr->sched_flags

and not because of

    attr->sched_flags & SCHED_FLAG_UTIL_CLAMP


And it also unblocks the uclamp-dl issue raised in
https://lkml.kernel.org/r/ad30be79-8fb2-023d-9936-01f7173164e4@arm.com
which surfaced when using `get_params()->__getparam_dl()` in
SYSCALL_DEFINE3(sched_setattr,...).
Just for reference, IIRC, you mentioned this already on irc.

Reviewed-by: Dietmar Eggemann <dietmar.eggemann@arm.com>

[...]

  reply	other threads:[~2021-07-29 16:26 UTC|newest]

Thread overview: 11+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-07-27 10:11 [PATCH 0/2] A couple of sched_getattr() fixes for DL Quentin Perret
2021-07-27 10:11 ` [PATCH 1/2] sched/deadline: Fix reset_on_fork reporting of DL tasks Quentin Perret
2021-07-29 16:26   ` Dietmar Eggemann [this message]
2021-08-05  9:34   ` [tip: sched/core] " tip-bot2 for Quentin Perret
2021-07-27 10:11 ` [PATCH 2/2] sched: Don't report SCHED_FLAG_SUGOV in sched_getattr() Quentin Perret
2021-07-28  9:12   ` Juri Lelli
2021-07-28  9:39     ` Quentin Perret
2021-07-28 12:36       ` Juri Lelli
2021-07-29 17:21         ` Dietmar Eggemann
2021-07-29 17:28           ` Quentin Perret
2021-08-05  9:34   ` [tip: sched/core] " tip-bot2 for Quentin Perret

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=e6d103f1-f8ee-cad9-c7c0-c9ea5d0f099a@arm.com \
    --to=dietmar.eggemann@arm.com \
    --cc=bristot@redhat.com \
    --cc=bsegall@google.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=qperret@google.com \
    --cc=rostedt@goodmis.org \
    --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).