Re: [PATCH v5 01/15] sched/core: uclamp: extend sched_setattr to support utilization clamping
From: Peter Zijlstra <peterz@infradead.org>
Date: 2018-11-07 12:10:00
Also in:
linux-pm, lkml
From: Peter Zijlstra <peterz@infradead.org>
Date: 2018-11-07 12:10:00
Also in:
linux-pm, lkml
On Mon, Oct 29, 2018 at 06:32:55PM +0000, Patrick Bellasi wrote:
diff --git a/include/uapi/linux/sched.h b/include/uapi/linux/sched.h index 22627f80063e..c27d6e81517b 100644 --- a/include/uapi/linux/sched.h +++ b/include/uapi/linux/sched.h@@ -50,9 +50,11 @@ #define SCHED_FLAG_RESET_ON_FORK 0x01 #define SCHED_FLAG_RECLAIM 0x02 #define SCHED_FLAG_DL_OVERRUN 0x04 +#define SCHED_FLAG_UTIL_CLAMP 0x08 #define SCHED_FLAG_ALL (SCHED_FLAG_RESET_ON_FORK | \ SCHED_FLAG_RECLAIM | \ - SCHED_FLAG_DL_OVERRUN) + SCHED_FLAG_DL_OVERRUN | \ + SCHED_FLAG_UTIL_CLAMP) #endif /* _UAPI_LINUX_SCHED_H */diff --git a/include/uapi/linux/sched/types.h b/include/uapi/linux/sched/types.h index 10fbb8031930..fde7301ed28c 100644 --- a/include/uapi/linux/sched/types.h +++ b/include/uapi/linux/sched/types.h@@ -9,6 +9,7 @@ struct sched_param { }; #define SCHED_ATTR_SIZE_VER0 48 /* sizeof first published struct */ +#define SCHED_ATTR_SIZE_VER1 56 /* add: util_{min,max} */ /* * Extended scheduling parameters data structure.
--- a/kernel/sched/core.c
+++ b/kernel/sched/core.c@@ -4533,6 +4533,10 @@ static int sched_copy_attr(struct sched_ if (ret) return -EFAULT; + if ((attr->sched_flags & SCHED_FLAG_UTIL_CLAMP) && + size < SCHED_ATTR_SIZE_VER1) + return -EINVAL; + /* * XXX: Do we want to be lenient like existing syscalls; or do we want * to be strict and return an error on out-of-bounds values?