[<prev] [next>] [<thread-prev] [day] [month] [year] [list]
Message-ID: <abec1bda-82bf-430e-9747-5aa4fa6ccacd@huaweicloud.com>
Date: Mon, 25 Aug 2025 08:52:18 +0800
From: Chen Ridong <chenridong@...weicloud.com>
To: Waiman Long <llong@...hat.com>, tj@...nel.org, hannes@...xchg.org,
mkoutny@...e.com
Cc: cgroups@...r.kernel.org, linux-kernel@...r.kernel.org,
lujialin4@...wei.com, chenridong@...wei.com
Subject: Re: [PATCH -next v4 2/3] cpuset: separate tmpmasks and cpuset
allocation logic
On 2025/8/25 1:05, Waiman Long wrote:
>
> On 8/18/25 2:41 AM, Chen Ridong wrote:
>> From: Chen Ridong <chenridong@...wei.com>
>>
>> The original alloc_cpumasks() served dual purposes: allocating cpumasks
>> for both temporary masks (tmpmasks) and cpuset structures. This patch:
>>
>> 1. Decouples these allocation paths for better code clarity
>> 2. Introduces dedicated alloc_tmpmasks() and dup_or_alloc_cpuset()
>> functions
>> 3. Maintains symmetric pairing:
>> - alloc_tmpmasks() ↔ free_tmpmasks()
>> - dup_or_alloc_cpuset() ↔ free_cpuset()
>>
>> Signed-off-by: Chen Ridong <chenridong@...wei.com>
>> ---
>> kernel/cgroup/cpuset.c | 128 ++++++++++++++++++++++-------------------
>> 1 file changed, 69 insertions(+), 59 deletions(-)
>>
>> diff --git a/kernel/cgroup/cpuset.c b/kernel/cgroup/cpuset.c
>> index aebda14cc67f..d5588a1fef60 100644
>> --- a/kernel/cgroup/cpuset.c
>> +++ b/kernel/cgroup/cpuset.c
>> @@ -411,51 +411,46 @@ static void guarantee_online_mems(struct cpuset *cs, nodemask_t *pmask)
>> }
>> /**
>> - * alloc_cpumasks - allocate three cpumasks for cpuset
>> - * @cs: the cpuset that have cpumasks to be allocated.
>> - * @tmp: the tmpmasks structure pointer
>> - * Return: 0 if successful, -ENOMEM otherwise.
>> + * alloc_cpumasks - Allocate an array of cpumask variables
>> + * @pmasks: Pointer to array of cpumask_var_t pointers
>> + * @size: Number of cpumasks to allocate
>> *
>> - * Only one of the two input arguments should be non-NULL.
>> + * Allocates @size cpumasks and initializes them to empty. Returns 0 on
>> + * success, -ENOMEM on allocation failure. On failure, any previously
>> + * allocated cpumasks are freed.
>
> The convention for the kernel-doc is to have a "Return:" tag if the function has a returned value.
> That "Return:" tag is deleted by this change. Your description does describe the returned value and
> no test robot failure was reported. Other than that, the rest of the patch looks good to me.
>
> Cheers,
> Longman
>
Thank you Longman, will update.
--
Best regards,
Ridong
Powered by blists - more mailing lists