Re: [PATCH v2] cgroup/cpuset: Fix update_prstate() always returning 0 on partition errors

From: Waiman Long

Date: Tue Jun 02 2026 - 14:46:06 EST



On 6/2/26 3:46 AM, Michal Koutný wrote:
Hi.

On Tue, Jun 02, 2026 at 12:55:21PM +0800, Tao Cui <cui.tao@xxxxxxxxx> wrote:
update_prstate() stores the error code in cs->prs_err and transitions
the partition to an invalid state, but always returns 0. The caller
cpuset_partition_write() uses "return retval ?: nbytes", so the write
syscall always appears to succeed from userspace even when the partition
became invalid.
Return -EINVAL when err is set so userspace can detect
the failure immediately.
This is quite a visible UAPI change (a write can succeed to invalidate a
partition) and users are meant to watch for cpuset.cpus.partition state
anyway for asynchronous changes.

Right, it is purposely done to not return a write error when writing any cpuset control files. The only exception is cpuset.cpus.exclusive which can return failure when  an exclusive CPU has been taken. It is documented in cgroup-v2.rst.

Cheers,
Longman