Re: [PATCH -tip 23/32] sched: Add a per-thread core scheduling interface

From: chris hyser
Date: Wed Dec 02 2020 - 18:18:37 EST


On 12/2/20 4:47 PM, Chris Hyser wrote:

+ get_task_struct(task);
+
+ /*
+ * Check if this process has the right to modify the specified
+ * process. Use the regular "ptrace_may_access()" checks.
+ */
+ if (!ptrace_may_access(task, PTRACE_MODE_READ_REALCREDS)) {
+ rcu_read_unlock();
+ err = -EPERM;
+ goto out;
+ }
+ rcu_read_unlock();
+
+ if (flags == PR_SCHED_CORE_CLEAR) {
+ dest = task;
+ src = NULL;
+ } else if (flags == PR_SCHED_CORE_SHARE_TO) {
+ dest = task;
+ src = current;
+ } else if (flags == PR_SCHED_CORE_SHARE_FROM) {
+ dest = current;
+ src = task;
+ }

I should have put in an else clause to catch bad input.

+
+ err = sched_core_share_tasks(dest, src);
out:
if (task)
put_task_struct(task);