From: Chen Ridong <chenridong@huawei.com>
The is_prs_invalid helper function is redundant as it serves a similar
purpose to is_partition_invalid. It can be fully replaced by the existing
is_partition_invalid function, so this patch removes the is_prs_invalid
helper.
Signed-off-by: Chen Ridong <chenridong@huawei.com>
---
kernel/cgroup/cpuset.c | 11 +++--------
1 file changed, 3 insertions(+), 8 deletions(-)
diff --git a/kernel/cgroup/cpuset.c b/kernel/cgroup/cpuset.c
index 196645b38b24..52468d2c178a 100644
--- a/kernel/cgroup/cpuset.c
+++ b/kernel/cgroup/cpuset.c
@@ -132,11 +132,6 @@ static bool force_sd_rebuild;
#define PRS_INVALID_ROOT -1
#define PRS_INVALID_ISOLATED -2
-static inline bool is_prs_invalid(int prs_state)
-{
- return prs_state < 0;
-}
-
/*
* Temporary cpumasks for working with partitions that are passed among
* functions to avoid memory allocation in inner functions.
@@ -1767,7 +1762,7 @@ static int update_parent_effective_cpumask(struct cpuset *cs, int cmd,
old_prs = new_prs = cs->partition_root_state;
if (cmd == partcmd_invalidate) {
- if (is_prs_invalid(old_prs))
+ if (is_partition_invalid(cs))
return 0;
/*
@@ -1874,7 +1869,7 @@ static int update_parent_effective_cpumask(struct cpuset *cs, int cmd,
* For invalid partition:
* delmask = newmask & parent->effective_xcpus
*/
- if (is_prs_invalid(old_prs)) {
+ if (is_partition_invalid(cs)) {
adding = false;
deleting = cpumask_and(tmp->delmask,
newmask, parent->effective_xcpus);
@@ -2964,7 +2959,7 @@ static int update_prstate(struct cpuset *cs, int new_prs)
/*
* Treat a previously invalid partition root as if it is a "member".
*/
- if (new_prs && is_prs_invalid(old_prs))
+ if (new_prs && is_partition_invalid(cs))
old_prs = PRS_MEMBER;
if (alloc_tmpmasks(&tmpmask))
--
2.34.1
On 9/22/25 9:02 AM, Chen Ridong wrote: > From: Chen Ridong <chenridong@huawei.com> > > The is_prs_invalid helper function is redundant as it serves a similar > purpose to is_partition_invalid. It can be fully replaced by the existing > is_partition_invalid function, so this patch removes the is_prs_invalid > helper. > > Signed-off-by: Chen Ridong <chenridong@huawei.com> > --- > kernel/cgroup/cpuset.c | 11 +++-------- > 1 file changed, 3 insertions(+), 8 deletions(-) > > diff --git a/kernel/cgroup/cpuset.c b/kernel/cgroup/cpuset.c > index 196645b38b24..52468d2c178a 100644 > --- a/kernel/cgroup/cpuset.c > +++ b/kernel/cgroup/cpuset.c > @@ -132,11 +132,6 @@ static bool force_sd_rebuild; > #define PRS_INVALID_ROOT -1 > #define PRS_INVALID_ISOLATED -2 > > -static inline bool is_prs_invalid(int prs_state) > -{ > - return prs_state < 0; > -} > - > /* > * Temporary cpumasks for working with partitions that are passed among > * functions to avoid memory allocation in inner functions. > @@ -1767,7 +1762,7 @@ static int update_parent_effective_cpumask(struct cpuset *cs, int cmd, > old_prs = new_prs = cs->partition_root_state; > > if (cmd == partcmd_invalidate) { > - if (is_prs_invalid(old_prs)) > + if (is_partition_invalid(cs)) > return 0; > > /* > @@ -1874,7 +1869,7 @@ static int update_parent_effective_cpumask(struct cpuset *cs, int cmd, > * For invalid partition: > * delmask = newmask & parent->effective_xcpus > */ > - if (is_prs_invalid(old_prs)) { > + if (is_partition_invalid(cs)) { > adding = false; > deleting = cpumask_and(tmp->delmask, > newmask, parent->effective_xcpus); > @@ -2964,7 +2959,7 @@ static int update_prstate(struct cpuset *cs, int new_prs) > /* > * Treat a previously invalid partition root as if it is a "member". > */ > - if (new_prs && is_prs_invalid(old_prs)) > + if (new_prs && is_partition_invalid(cs)) > old_prs = PRS_MEMBER; > > if (alloc_tmpmasks(&tmpmask)) Acked-by: Waiman Long <longman@redhat.com>
© 2016 - 2025 Red Hat, Inc.