linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Quentin Perret <qperret@google.com>
To: Juri Lelli <juri.lelli@redhat.com>
Cc: Ingo Molnar <mingo@redhat.com>,
	Peter Zijlstra <peterz@infradead.org>,
	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>,
	linux-kernel@vger.kernel.org
Subject: Re: [PATCH 2/2] sched: Don't report SCHED_FLAG_SUGOV in sched_getattr()
Date: Wed, 28 Jul 2021 10:39:38 +0100	[thread overview]
Message-ID: <YQEl2t2RgaB9eEOZ@google.com> (raw)
In-Reply-To: <YQEfY730Sjkr3w+Y@localhost.localdomain>

On Wednesday 28 Jul 2021 at 11:12:03 (+0200), Juri Lelli wrote:
> Hi Quentin,
> 
> On 27/07/21 11:11, Quentin Perret wrote:
> > SCHED_FLAG_SUGOV is supposed to be a kernel-only flag that userspace
> > cannot interact with. However, sched_getattr() currently reports it
> > in sched_flags if called on a sugov worker even though it is not
> > actually defined in a UAPI header. To avoid this, make sure to
> > clean-up the sched_flags field in sched_getattr() before returning to
> > userspace.
> > 
> > Signed-off-by: Quentin Perret <qperret@google.com>
> > ---
> >  kernel/sched/core.c | 1 +
> >  1 file changed, 1 insertion(+)
> > 
> > diff --git a/kernel/sched/core.c b/kernel/sched/core.c
> > index 2d9ff40f4661..d8f489dcc383 100644
> > --- a/kernel/sched/core.c
> > +++ b/kernel/sched/core.c
> > @@ -7535,6 +7535,7 @@ SYSCALL_DEFINE4(sched_getattr, pid_t, pid, struct sched_attr __user *, uattr,
> >  		kattr.sched_priority = p->rt_priority;
> >  	else
> >  		kattr.sched_nice = task_nice(p);
> > +	kattr.sched_flags &= SCHED_FLAG_ALL;
> 
> Maybe we can do this in the previous patch so that it's kept confined to
> deadline bits?

That works too, it just felt like this could happen again if we start
using non-standard flags outside of deadline for any reason at some
point in the future. But no strong opinion really.

Cheers,
Quentin

  reply	other threads:[~2021-07-28  9:39 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
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 [this message]
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=YQEl2t2RgaB9eEOZ@google.com \
    --to=qperret@google.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=peterz@infradead.org \
    --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).