From: Waiman Long <llong@redhat.com>
To: Chen Ridong <chenridong@huaweicloud.com>,
tj@kernel.org, hannes@cmpxchg.org, mkoutny@suse.com
Cc: cgroups@vger.kernel.org, linux-kernel@vger.kernel.org,
lujialin4@huawei.com, chenridong@huawei.com
Subject: Re: [PATCH -next 1/3] cpuset: remove redundant special case for null input in node mask update
Date: Mon, 22 Sep 2025 17:36:57 -0400 [thread overview]
Message-ID: <3108a41d-24b2-4a0d-bc71-3e62ff97054b@redhat.com> (raw)
In-Reply-To: <20250922130233.3237521-2-chenridong@huaweicloud.com>
On 9/22/25 9:02 AM, Chen Ridong wrote:
> From: Chen Ridong <chenridong@huawei.com>
>
> The nodelist_parse function already handles empty nodemask input
> appropriately, making it unnecessary to handle this case separately
> during the node mask update process.
>
> Signed-off-by: Chen Ridong <chenridong@huawei.com>
> ---
> kernel/cgroup/cpuset.c | 22 ++++++++--------------
> 1 file changed, 8 insertions(+), 14 deletions(-)
>
> diff --git a/kernel/cgroup/cpuset.c b/kernel/cgroup/cpuset.c
> index 535174ed7126..20dface3c3e0 100644
> --- a/kernel/cgroup/cpuset.c
> +++ b/kernel/cgroup/cpuset.c
> @@ -2847,22 +2847,16 @@ static int update_nodemask(struct cpuset *cs, struct cpuset *trialcs,
>
> /*
> * An empty mems_allowed is ok iff there are no tasks in the cpuset.
> - * Since nodelist_parse() fails on an empty mask, we special case
> - * that parsing. The validate_change() call ensures that cpusets
> - * with tasks have memory.
> + * The validate_change() call ensures that cpusets with tasks have memory.
> */
> - if (!*buf) {
> - nodes_clear(trialcs->mems_allowed);
> - } else {
> - retval = nodelist_parse(buf, trialcs->mems_allowed);
> - if (retval < 0)
> - goto done;
> + retval = nodelist_parse(buf, trialcs->mems_allowed);
> + if (retval < 0)
> + goto done;
>
> - if (!nodes_subset(trialcs->mems_allowed,
> - top_cpuset.mems_allowed)) {
> - retval = -EINVAL;
> - goto done;
> - }
> + if (!nodes_subset(trialcs->mems_allowed,
> + top_cpuset.mems_allowed)) {
> + retval = -EINVAL;
> + goto done;
> }
>
> if (nodes_equal(cs->mems_allowed, trialcs->mems_allowed)) {
Right, the *buf check is no longer need with the current version fof
nodelist_parse().
Reveiwed-by: Waiman Long <longman@redhat.com>
next prev parent reply other threads:[~2025-09-22 21:37 UTC|newest]
Thread overview: 8+ messages / expand[flat|nested] mbox.gz Atom feed top
2025-09-22 13:02 [PATCH -next 0/3] cpuset: code cleanup and redundancy removal Chen Ridong
2025-09-22 13:02 ` [PATCH -next 1/3] cpuset: remove redundant special case for null input in node mask update Chen Ridong
2025-09-22 21:36 ` Waiman Long [this message]
2025-09-22 13:02 ` [PATCH -next 2/3] cpuset: remove impossible warning in update_parent_effective_cpumask Chen Ridong
2025-09-22 21:37 ` Waiman Long
2025-09-22 13:02 ` [PATCH -next 3/3] cpuset: remove is_prs_invalid helper Chen Ridong
2025-09-22 21:37 ` Waiman Long
2025-09-22 23:10 ` [PATCH 0/3] cpuset: code cleanup and redundancy removal Tejun Heo
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=3108a41d-24b2-4a0d-bc71-3e62ff97054b@redhat.com \
--to=llong@redhat.com \
--cc=cgroups@vger.kernel.org \
--cc=chenridong@huawei.com \
--cc=chenridong@huaweicloud.com \
--cc=hannes@cmpxchg.org \
--cc=linux-kernel@vger.kernel.org \
--cc=lujialin4@huawei.com \
--cc=mkoutny@suse.com \
--cc=tj@kernel.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox