Skip to content

sched/core: Make sched_setaffinity() always return -EINVAL on empty cpumask

JIRA: https://issues.redhat.com/browse/RHEL-21440
MR: !3729 (merged)

Since RHEL commit 05fddaaa ("sched/core: Use empty mask to reset cpumasks in sched_setaffinity()"), an empty cpumask is used for resetting a user requested CPU affinity set by a previous sched_setaffinity() call. An error code of -ENODEV is returned for a successful reset. However, this broke some test cases that only expects an error code of -EINVAL. So another RHEL commit 90f7bb0c ("sched/core: Don't return -ENODEV from sched_setaffinity()") was merged to return 0 in that case. Again, this still broke some other test cases.

This patch restores the old behavior of always returning -EINVAL on an empty cpumask with the exception that 0 may still be returned if the empty cpumask is caused by a input len parameter of 0 which is another way of resetting user requested CPU affinity that I had proposed to upstream before.

Fixes: 90f7bb0c ("sched/core: Don't return -ENODEV from sched_setaffinity()") Signed-off-by: Waiman Long longman@redhat.com

Edited by Waiman Long

Merge request reports