[<prev] [next>] [<thread-prev] [day] [month] [year] [list]
Message-ID: <20190125135646.j4j2onitam4mwvcw@google.com>
Date: Fri, 25 Jan 2019 13:56:46 +0000
From: Alessio Balsini <balsini@...roid.com>
To: Patrick Bellasi <patrick.bellasi@....com>
Cc: linux-kernel@...r.kernel.org, linux-pm@...r.kernel.org,
linux-api@...r.kernel.org, Ingo Molnar <mingo@...hat.com>,
Peter Zijlstra <peterz@...radead.org>,
Tejun Heo <tj@...nel.org>,
"Rafael J . Wysocki" <rafael.j.wysocki@...el.com>,
Vincent Guittot <vincent.guittot@...aro.org>,
Viresh Kumar <viresh.kumar@...aro.org>,
Paul Turner <pjt@...gle.com>,
Quentin Perret <quentin.perret@....com>,
Dietmar Eggemann <dietmar.eggemann@....com>,
Morten Rasmussen <morten.rasmussen@....com>,
Juri Lelli <juri.lelli@...hat.com>,
Todd Kjos <tkjos@...gle.com>,
Joel Fernandes <joelaf@...gle.com>,
Steve Muckle <smuckle@...gle.com>,
Suren Baghdasaryan <surenb@...gle.com>
Subject: Re: [PATCH v6 01/16] sched/core: Allow sched_setattr() to use the
current policy
Hello Patrick,
What do you think about the following minor changes:
On Tue, Jan 15, 2019 at 10:14:58AM +0000, Patrick Bellasi wrote:
> /* SCHED_ISO: reserved but not implemented yet */
> #define SCHED_IDLE 5
> #define SCHED_DEADLINE 6
> +/* Must be the last entry: used to sanity check attr.policy values */
I would remove this comment:
- the meaning of SCHED_POLICY_MAX is evident, and
- should we hint on how the value is used? That comment will be removed
the next time SCHED_POLICY_MAX is used for something else.
This is what should also happen to the comment of SETPARAM_POLICY:
now sched_setparam() is no more the only code path accessing
SETPARAM_POLICY.
> +#define SCHED_POLICY_MAX 7
+#define SCHED_POLICY_MAX SCHED_DEADLINE
This would make it compliant with the definition of MAX.
> --- a/kernel/sched/core.c
> +++ b/kernel/sched/core.c
> @@ -4560,8 +4560,17 @@ SYSCALL_DEFINE3(sched_setattr, pid_t, pid, struct sched_attr __user *, uattr,
> if (retval)
> return retval;
>
> - if ((int)attr.sched_policy < 0)
> + /*
> + * A valid policy is always required from userspace, unless
> + * SCHED_FLAG_KEEP_POLICY is set and the current policy
> + * is enforced for this call.
> + */
> + if (attr.sched_policy >= SCHED_POLICY_MAX &&
+ if (attr.sched_policy > SCHED_POLICY_MAX &&
In line with the previous update.
> + !(attr.sched_flags & SCHED_FLAG_KEEP_POLICY)) {
> return -EINVAL;
Thanks,
Alessio
Powered by blists - more mailing lists