On Thu, May 09, 2019 at 10:18:07AM +0100, Patrick Bellasi wrote: > On 08-May 21:21, Peter Zijlstra wrote: > > On Tue, Apr 02, 2019 at 11:41:41AM +0100, Patrick Bellasi wrote: > > > diff --git a/include/uapi/linux/sched.h b/include/uapi/linux/sched.h > > > index 22627f80063e..075c610adf45 100644 > > > --- a/include/uapi/linux/sched.h > > > +++ b/include/uapi/linux/sched.h > > > @@ -40,6 +40,8 @@ > > > /* 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 */ > > > +#define SCHED_POLICY_MAX SCHED_DEADLINE > > > > This is a wee bit sad to put in a uapi header; but yeah, where else :/ > > > > Another option would be something like: > > > > enum { > > SCHED_NORMAL = 0, > > SCHED_FIFO = 1, > > SCHED_RR = 2, > > SCHED_BATCH = 3, > > /* SCHED_ISO = 4, reserved */ > > SCHED_IDLE = 5, > > SCHED_DEADLINE = 6, > > SCHED_POLICY_NR > > }; > > I just wanted to minimize the changes by keeping the same structure... > If you prefer the above I can add a refactoring patch just to update > existing definitions before adding this patch... Right; I've no idea really. The thing that started all this was adding that define to UAPI. Maybe we can do without it and instead put in a comment to check sched_setattr() any time we add a new policy and just hard code the thing.