Re: [PATCH -next 1/3] cpuset: simplify node setting on error

From: Chen Ridong
Date: Tue Nov 11 2025 - 01:16:56 EST




On 2025/11/11 12:26, Waiman Long wrote:
> On 11/9/25 8:52 PM, Chen Ridong wrote:
>> From: Chen Ridong <chenridong@xxxxxxxxxx>
>>
>> There is no need to jump to the 'done' label upon failure, as no cleanup
>> is required. Return the error code directly instead.
>>
>> Signed-off-by: Chen Ridong <chenridong@xxxxxxxxxx>
>> ---
>>   kernel/cgroup/cpuset.c | 21 +++++++++------------
>>   1 file changed, 9 insertions(+), 12 deletions(-)
>>
>> diff --git a/kernel/cgroup/cpuset.c b/kernel/cgroup/cpuset.c
>> index 8238fd8c0c29..c90476d52f09 100644
>> --- a/kernel/cgroup/cpuset.c
>> +++ b/kernel/cgroup/cpuset.c
>> @@ -2897,21 +2897,19 @@ static int update_nodemask(struct cpuset *cs, struct cpuset *trialcs,
>>        */
>>       retval = nodelist_parse(buf, trialcs->mems_allowed);
>>       if (retval < 0)
>> -        goto done;
>> +        return retval;
>>         if (!nodes_subset(trialcs->mems_allowed,
>> -              top_cpuset.mems_allowed)) {
>> -        retval = -EINVAL;
>> -        goto done;
>> -    }
>> +              top_cpuset.mems_allowed))
>> +        return -EINVAL;
>> +
>> +    /* No change? nothing to do */
>> +    if (nodes_equal(cs->mems_allowed, trialcs->mems_allowed))
>> +        return 0;
>>   -    if (nodes_equal(cs->mems_allowed, trialcs->mems_allowed)) {
>> -        retval = 0;        /* Too easy - nothing to do */
>> -        goto done;
>> -    }
>>       retval = validate_change(cs, trialcs);
>>       if (retval < 0)
>> -        goto done;
>> +        return retval;
>>         check_insane_mems_config(&trialcs->mems_allowed);
>>   @@ -2921,8 +2919,7 @@ static int update_nodemask(struct cpuset *cs, struct cpuset *trialcs,
>>         /* use trialcs->mems_allowed as a temp variable */
>>       update_nodemasks_hier(cs, &trialcs->mems_allowed);
>> -done:
>> -    return retval;
>> +    return 0;
>>   }
>>     bool current_cpuset_is_being_rebound(void)
> Reviewed-by: Waiman Long <longman@xxxxxxxxxx>
>

Thanks.

--
Best regards,
Ridong