summaryrefslogtreecommitdiffstats
path: root/kernel
diff options
context:
space:
mode:
authorEugene Syromiatnikov <esyr@redhat.com>2021-08-25 19:06:13 +0200
committerChristian Brauner <christian.brauner@ubuntu.com>2021-09-29 13:00:05 +0200
commit61bc346ce64a3864ac55f5d18bdc1572cda4fb18 (patch)
tree8831e8255d83b58f047a7cae374fc1ab089b68b1 /kernel
parent5816b3e6577eaa676ceb00a848f0fd65fe2adc29 (diff)
downloadlinux-61bc346ce64a3864ac55f5d18bdc1572cda4fb18.tar.gz
linux-61bc346ce64a3864ac55f5d18bdc1572cda4fb18.tar.bz2
linux-61bc346ce64a3864ac55f5d18bdc1572cda4fb18.zip
uapi/linux/prctl: provide macro definitions for the PR_SCHED_CORE type argument
Commit 7ac592aa35a684ff ("sched: prctl() core-scheduling interface") made use of enum pid_type in prctl's arg4; this type and the associated enumeration definitions are not exposed to userspace. Christian has suggested to provide additional macro definitions that convey the meaning of the type argument more in alignment with its actual usage, and this patch does exactly that. Link: https://lore.kernel.org/r/20210825170613.GA3884@asgard.redhat.com Suggested-by: Christian Brauner <christian.brauner@ubuntu.com> Acked-by: Christian Brauner <christian.brauner@ubuntu.com> Signed-off-by: Eugene Syromiatnikov <esyr@redhat.com> Complements: 7ac592aa35a684ff ("sched: prctl() core-scheduling interface") Signed-off-by: Christian Brauner <christian.brauner@ubuntu.com>
Diffstat (limited to 'kernel')
-rw-r--r--kernel/sched/core_sched.c4
1 files changed, 4 insertions, 0 deletions
diff --git a/kernel/sched/core_sched.c b/kernel/sched/core_sched.c
index 9a80e9a474c0..20f640949450 100644
--- a/kernel/sched/core_sched.c
+++ b/kernel/sched/core_sched.c
@@ -134,6 +134,10 @@ int sched_core_share_pid(unsigned int cmd, pid_t pid, enum pid_type type,
if (!static_branch_likely(&sched_smt_present))
return -ENODEV;
+ BUILD_BUG_ON(PR_SCHED_CORE_SCOPE_THREAD != PIDTYPE_PID);
+ BUILD_BUG_ON(PR_SCHED_CORE_SCOPE_THREAD_GROUP != PIDTYPE_TGID);
+ BUILD_BUG_ON(PR_SCHED_CORE_SCOPE_PROCESS_GROUP != PIDTYPE_PGID);
+
if (type > PIDTYPE_PGID || cmd >= PR_SCHED_CORE_MAX || pid < 0 ||
(cmd != PR_SCHED_CORE_GET && uaddr))
return -EINVAL;