* [PATCH-next v2 0/2] cgroup/cpuset: Run SCHED_DEADLINE shrink test on valid partition root only
@ 2026-09-27 21:53 Waiman Long
2026-09-27 21:53 ` [PATCH-next v2 1/2] " Waiman Long
` (2 more replies)
0 siblings, 3 replies; 8+ messages in thread
From: Waiman Long @ 2026-09-27 21:53 UTC (permalink / raw)
To: Ridong Chen, Tejun Heo, Johannes Weiner, Michal Koutný
Cc: cgroups, linux-kernel, Hui Peng, Guopeng Zhang, Waiman Long
v2:
- Leave the v1 code as is and switch between using is_cpu_exclusive()
for v1 and is_partition_valid() for v2.
When testing some upstream cpuset patch, it was found that the current
SCHED_DEADLINE shrink test in validate_change() can incorrectly get
triggered due to the fact that the exclusive flag may get set on a
cpuset that is not a valid partition root. This series fixes this
problem by making sure that the test will only be triggered on a valid
partition root and remove the now unnecessary code to handle the
exclusive flag in the v2 code.
Waiman Long (2):
cgroup/cpuset: Run SCHED_DEADLINE shrink test on valid partition root
only
cgroup/cpuset: Remove CS_CPU_EXCLUSIVE handling code from v2
kernel/cgroup/cpuset.c | 59 ++++++------------------------------------
1 file changed, 8 insertions(+), 51 deletions(-)
--
2.55.0
^ permalink raw reply [flat|nested] 8+ messages in thread
* [PATCH-next v2 1/2] cgroup/cpuset: Run SCHED_DEADLINE shrink test on valid partition root only
2026-09-27 21:53 [PATCH-next v2 0/2] cgroup/cpuset: Run SCHED_DEADLINE shrink test on valid partition root only Waiman Long
@ 2026-09-27 21:53 ` Waiman Long
2026-09-28 7:46 ` Ridong Chen
2026-09-28 9:32 ` Guopeng Zhang
2026-09-27 21:53 ` [PATCH-next v2 2/2] cgroup/cpuset: Remove CS_CPU_EXCLUSIVE handling code from v2 Waiman Long
2026-09-28 17:41 ` [PATCH-next v2 0/2] cgroup/cpuset: Run SCHED_DEADLINE shrink test on valid partition root only Tejun Heo
2 siblings, 2 replies; 8+ messages in thread
From: Waiman Long @ 2026-09-27 21:53 UTC (permalink / raw)
To: Ridong Chen, Tejun Heo, Johannes Weiner, Michal Koutný
Cc: cgroups, linux-kernel, Hui Peng, Guopeng Zhang, Waiman Long
Commit f82f80426f7a ("sched/deadline: Ensure that updates to exclusive
cpusets don't break AC") adds a check in validate_change() to make
sure that there is enough bandwidth for SCHED_DEADLINE tasks if we
shrink a v1 exclusive cpuset that has CS_CPU_EXCLUSIVE flag set.
With the introduction of cpuset partition in cgroup v2, we keep setting
the CS_CPU_EXCLUSIVE flag for a partition root so that the SCHED_DEADLINE
check will continue to work as intended. However it turns out that the
current code isn't perfect and there are cases where a cpuset isn't
a valid partition root, but the exclusive flag is still incorrectly
set. This can leads to SCHED_DEADLINE check being incorrectly triggered
when there are deadline tasks in the system. This can result in unexpected
-EBUSY failure when making changes to cpuset control files. Fix that
by checking for a valid partition root for v2 and is_cpu_exclusive()
for v1. It is far easier and less cumbersome than to make sure that
the exclusive flag is only set for valid partition roots.
Even though commit a86ce68078b2 ("cgroup/cpuset: Extract out
CS_CPU_EXCLUSIVE & CS_SCHED_LOAD_BALANCE handling") is marked as a
commit to be fixed, the problem may exist before that.
Fixes: a86ce68078b2 ("cgroup/cpuset: Extract out CS_CPU_EXCLUSIVE & CS_SCHED_LOAD_BALANCE handling")
Signed-off-by: Waiman Long <longman@redhat.com>
---
kernel/cgroup/cpuset.c | 7 ++++---
1 file changed, 4 insertions(+), 3 deletions(-)
diff --git a/kernel/cgroup/cpuset.c b/kernel/cgroup/cpuset.c
index 753aa65afcd7..104fe10c336d 100644
--- a/kernel/cgroup/cpuset.c
+++ b/kernel/cgroup/cpuset.c
@@ -771,8 +771,8 @@ static int validate_change(struct cpuset *cur, struct cpuset *trial)
* For v1, effective_cpus == cpus_allowed & user_xcpus() returns
* cpus_allowed.
*
- * For v2, is_cpu_exclusive() & is_sched_load_balance() are true only
- * for non-isolated partition root. At this point, the target
+ * For v2, is_partition_valid(cur) & is_sched_load_balance() are true
+ * only for non-isolated partition root. At this point, the target
* effective_cpus isn't computed yet. user_xcpus() is the best
* approximation.
*
@@ -781,7 +781,8 @@ static int validate_change(struct cpuset *cur, struct cpuset *trial)
* becomes an issue.
*/
ret = -EBUSY;
- if (is_cpu_exclusive(cur) && is_sched_load_balance(cur) &&
+ if ((is_partition_valid(cur) || (!cpuset_v2() && is_cpu_exclusive(cur))) &&
+ is_sched_load_balance(cur) &&
!cpuset_cpumask_can_shrink(cur->effective_cpus, user_xcpus(trial)))
goto out;
--
2.55.0
^ permalink raw reply [flat|nested] 8+ messages in thread
* [PATCH-next v2 2/2] cgroup/cpuset: Remove CS_CPU_EXCLUSIVE handling code from v2
2026-09-27 21:53 [PATCH-next v2 0/2] cgroup/cpuset: Run SCHED_DEADLINE shrink test on valid partition root only Waiman Long
2026-09-27 21:53 ` [PATCH-next v2 1/2] " Waiman Long
@ 2026-09-27 21:53 ` Waiman Long
2026-09-28 7:53 ` Ridong Chen
2026-09-28 9:32 ` Guopeng Zhang
2026-09-28 17:41 ` [PATCH-next v2 0/2] cgroup/cpuset: Run SCHED_DEADLINE shrink test on valid partition root only Tejun Heo
2 siblings, 2 replies; 8+ messages in thread
From: Waiman Long @ 2026-09-27 21:53 UTC (permalink / raw)
To: Ridong Chen, Tejun Heo, Johannes Weiner, Michal Koutný
Cc: cgroups, linux-kernel, Hui Peng, Guopeng Zhang, Waiman Long
As the is_cpu_exclusive() function is only used for DEADLINE shrink
test with v1 there is no need to have the CS_CPU_EXCLUSIVE flag set on
valid partition root anymore. Remove update_partition_exclusive_flag()
and other CS_CPU_EXCLUSIVE flag handling code in cpuset.c.
Signed-off-by: Waiman Long <longman@redhat.com>
---
kernel/cgroup/cpuset.c | 52 ++++--------------------------------------
1 file changed, 4 insertions(+), 48 deletions(-)
diff --git a/kernel/cgroup/cpuset.c b/kernel/cgroup/cpuset.c
index 104fe10c336d..4a915da37bb3 100644
--- a/kernel/cgroup/cpuset.c
+++ b/kernel/cgroup/cpuset.c
@@ -1174,25 +1174,6 @@ enum partition_cmd {
static void update_sibling_cpumasks(struct cpuset *parent, struct cpuset *cs,
struct tmpmasks *tmp);
-/*
- * Update partition exclusive flag
- *
- * Return: 0 if successful, an error code otherwise
- */
-static int update_partition_exclusive_flag(struct cpuset *cs, int new_prs)
-{
- bool exclusive = (new_prs > PRS_MEMBER);
-
- if (exclusive && !is_cpu_exclusive(cs)) {
- if (cpuset_update_flag(CS_CPU_EXCLUSIVE, cs, 1))
- return PERR_NOTEXCL;
- } else if (!exclusive && is_cpu_exclusive(cs)) {
- /* Turning off CS_CPU_EXCLUSIVE will not return error */
- cpuset_update_flag(CS_CPU_EXCLUSIVE, cs, 0);
- }
- return 0;
-}
-
/*
* Update partition load balance flag and/or rebuild sched domain
*
@@ -1248,11 +1229,9 @@ static void reset_partition_data(struct cpuset *cs)
lockdep_assert_held(&callback_lock);
- if (cpumask_empty(cs->exclusive_cpus)) {
+ if (cpumask_empty(cs->exclusive_cpus))
cpumask_clear(cs->effective_xcpus);
- if (is_cpu_exclusive(cs))
- clear_bit(CS_CPU_EXCLUSIVE, &cs->flags);
- }
+
if (!cpumask_and(cs->effective_cpus, parent->effective_cpus, cs->cpus_allowed))
cpumask_copy(cs->effective_cpus, parent->effective_cpus);
}
@@ -2028,19 +2007,6 @@ static int update_parent_effective_cpumask(struct cpuset *cs, int cmd,
if (!adding && !deleting && (new_prs == old_prs))
return 0;
- /*
- * Transitioning between invalid to valid or vice versa may require
- * changing CS_CPU_EXCLUSIVE. In the case of partcmd_update,
- * validate_change() has already been successfully called and
- * CPU lists in cs haven't been updated yet. So defer it to later.
- */
- if ((old_prs != new_prs) && (cmd != partcmd_update)) {
- int err = update_partition_exclusive_flag(cs, new_prs);
-
- if (err)
- return err;
- }
-
/*
* Change the parent's effective_cpus & effective_xcpus (top cpuset
* only).
@@ -2063,9 +2029,6 @@ static int update_parent_effective_cpumask(struct cpuset *cs, int cmd,
spin_unlock_irq(&callback_lock);
- if ((old_prs != new_prs) && (cmd == partcmd_update))
- update_partition_exclusive_flag(cs, new_prs);
-
if (adding || deleting) {
cpuset_update_tasks_cpumask(parent, tmp->addmask);
update_sibling_cpumasks(parent, cs, tmp);
@@ -2942,10 +2905,6 @@ static int update_prstate(struct cpuset *cs, int new_prs)
if (alloc_tmpmasks(&tmpmask))
return -ENOMEM;
- err = update_partition_exclusive_flag(cs, new_prs);
- if (err)
- goto out;
-
if (!old_prs) {
/*
* cpus_allowed and exclusive_cpus cannot be both empty.
@@ -3009,13 +2968,10 @@ static int update_prstate(struct cpuset *cs, int new_prs)
}
out:
/*
- * Make partition invalid & disable CS_CPU_EXCLUSIVE if an error
- * happens.
+ * Make partition invalid if an error happens.
*/
- if (err) {
+ if (err)
new_prs = -new_prs;
- update_partition_exclusive_flag(cs, new_prs);
- }
spin_lock_irq(&callback_lock);
cs->partition_root_state = new_prs;
--
2.55.0
^ permalink raw reply [flat|nested] 8+ messages in thread
* Re: [PATCH-next v2 1/2] cgroup/cpuset: Run SCHED_DEADLINE shrink test on valid partition root only
2026-09-27 21:53 ` [PATCH-next v2 1/2] " Waiman Long
@ 2026-09-28 7:46 ` Ridong Chen
2026-09-28 9:32 ` Guopeng Zhang
1 sibling, 0 replies; 8+ messages in thread
From: Ridong Chen @ 2026-09-28 7:46 UTC (permalink / raw)
To: Waiman Long, Tejun Heo, Johannes Weiner, Michal Koutný
Cc: cgroups, linux-kernel, Hui Peng, Guopeng Zhang
On 9/28/2026 5:53 AM, Waiman Long wrote:
> Commit f82f80426f7a ("sched/deadline: Ensure that updates to exclusive
> cpusets don't break AC") adds a check in validate_change() to make
> sure that there is enough bandwidth for SCHED_DEADLINE tasks if we
> shrink a v1 exclusive cpuset that has CS_CPU_EXCLUSIVE flag set.
>
> With the introduction of cpuset partition in cgroup v2, we keep setting
> the CS_CPU_EXCLUSIVE flag for a partition root so that the SCHED_DEADLINE
> check will continue to work as intended. However it turns out that the
> current code isn't perfect and there are cases where a cpuset isn't
> a valid partition root, but the exclusive flag is still incorrectly
> set. This can leads to SCHED_DEADLINE check being incorrectly triggered
> when there are deadline tasks in the system. This can result in unexpected
> -EBUSY failure when making changes to cpuset control files. Fix that
> by checking for a valid partition root for v2 and is_cpu_exclusive()
> for v1. It is far easier and less cumbersome than to make sure that
> the exclusive flag is only set for valid partition roots.
>
> Even though commit a86ce68078b2 ("cgroup/cpuset: Extract out
> CS_CPU_EXCLUSIVE & CS_SCHED_LOAD_BALANCE handling") is marked as a
> commit to be fixed, the problem may exist before that.
>
> Fixes: a86ce68078b2 ("cgroup/cpuset: Extract out CS_CPU_EXCLUSIVE & CS_SCHED_LOAD_BALANCE handling")
> Signed-off-by: Waiman Long <longman@redhat.com>
> ---
> kernel/cgroup/cpuset.c | 7 ++++---
> 1 file changed, 4 insertions(+), 3 deletions(-)
>
> diff --git a/kernel/cgroup/cpuset.c b/kernel/cgroup/cpuset.c
> index 753aa65afcd7..104fe10c336d 100644
> --- a/kernel/cgroup/cpuset.c
> +++ b/kernel/cgroup/cpuset.c
> @@ -771,8 +771,8 @@ static int validate_change(struct cpuset *cur, struct cpuset *trial)
> * For v1, effective_cpus == cpus_allowed & user_xcpus() returns
> * cpus_allowed.
> *
> - * For v2, is_cpu_exclusive() & is_sched_load_balance() are true only
> - * for non-isolated partition root. At this point, the target
> + * For v2, is_partition_valid(cur) & is_sched_load_balance() are true
> + * only for non-isolated partition root. At this point, the target
> * effective_cpus isn't computed yet. user_xcpus() is the best
> * approximation.
> *
> @@ -781,7 +781,8 @@ static int validate_change(struct cpuset *cur, struct cpuset *trial)
> * becomes an issue.
> */
> ret = -EBUSY;
> - if (is_cpu_exclusive(cur) && is_sched_load_balance(cur) &&
> + if ((is_partition_valid(cur) || (!cpuset_v2() && is_cpu_exclusive(cur))) &&
> + is_sched_load_balance(cur) &&
> !cpuset_cpumask_can_shrink(cur->effective_cpus, user_xcpus(trial)))
> goto out;
>
Reviewed-by: Ridong Chen <ridong.chen@linux.dev>
Thanks.
--
Best regards
Ridong
^ permalink raw reply [flat|nested] 8+ messages in thread
* Re: [PATCH-next v2 2/2] cgroup/cpuset: Remove CS_CPU_EXCLUSIVE handling code from v2
2026-09-27 21:53 ` [PATCH-next v2 2/2] cgroup/cpuset: Remove CS_CPU_EXCLUSIVE handling code from v2 Waiman Long
@ 2026-09-28 7:53 ` Ridong Chen
2026-09-28 9:32 ` Guopeng Zhang
1 sibling, 0 replies; 8+ messages in thread
From: Ridong Chen @ 2026-09-28 7:53 UTC (permalink / raw)
To: Waiman Long, Tejun Heo, Johannes Weiner, Michal Koutný
Cc: cgroups, linux-kernel, Hui Peng, Guopeng Zhang
On 9/28/2026 5:53 AM, Waiman Long wrote:
> As the is_cpu_exclusive() function is only used for DEADLINE shrink
> test with v1 there is no need to have the CS_CPU_EXCLUSIVE flag set on
> valid partition root anymore. Remove update_partition_exclusive_flag()
> and other CS_CPU_EXCLUSIVE flag handling code in cpuset.c.
>
> Signed-off-by: Waiman Long <longman@redhat.com>
> ---
> kernel/cgroup/cpuset.c | 52 ++++--------------------------------------
> 1 file changed, 4 insertions(+), 48 deletions(-)
>
> diff --git a/kernel/cgroup/cpuset.c b/kernel/cgroup/cpuset.c
> index 104fe10c336d..4a915da37bb3 100644
> --- a/kernel/cgroup/cpuset.c
> +++ b/kernel/cgroup/cpuset.c
> @@ -1174,25 +1174,6 @@ enum partition_cmd {
> static void update_sibling_cpumasks(struct cpuset *parent, struct cpuset *cs,
> struct tmpmasks *tmp);
>
> -/*
> - * Update partition exclusive flag
> - *
> - * Return: 0 if successful, an error code otherwise
> - */
> -static int update_partition_exclusive_flag(struct cpuset *cs, int new_prs)
> -{
> - bool exclusive = (new_prs > PRS_MEMBER);
> -
> - if (exclusive && !is_cpu_exclusive(cs)) {
> - if (cpuset_update_flag(CS_CPU_EXCLUSIVE, cs, 1))
> - return PERR_NOTEXCL;
> - } else if (!exclusive && is_cpu_exclusive(cs)) {
> - /* Turning off CS_CPU_EXCLUSIVE will not return error */
> - cpuset_update_flag(CS_CPU_EXCLUSIVE, cs, 0);
> - }
> - return 0;
> -}
> -
> /*
> * Update partition load balance flag and/or rebuild sched domain
> *
> @@ -1248,11 +1229,9 @@ static void reset_partition_data(struct cpuset *cs)
>
> lockdep_assert_held(&callback_lock);
>
> - if (cpumask_empty(cs->exclusive_cpus)) {
> + if (cpumask_empty(cs->exclusive_cpus))
> cpumask_clear(cs->effective_xcpus);
> - if (is_cpu_exclusive(cs))
> - clear_bit(CS_CPU_EXCLUSIVE, &cs->flags);
> - }
> +
> if (!cpumask_and(cs->effective_cpus, parent->effective_cpus, cs->cpus_allowed))
> cpumask_copy(cs->effective_cpus, parent->effective_cpus);
> }
> @@ -2028,19 +2007,6 @@ static int update_parent_effective_cpumask(struct cpuset *cs, int cmd,
> if (!adding && !deleting && (new_prs == old_prs))
> return 0;
>
> - /*
> - * Transitioning between invalid to valid or vice versa may require
> - * changing CS_CPU_EXCLUSIVE. In the case of partcmd_update,
> - * validate_change() has already been successfully called and
> - * CPU lists in cs haven't been updated yet. So defer it to later.
> - */
> - if ((old_prs != new_prs) && (cmd != partcmd_update)) {
> - int err = update_partition_exclusive_flag(cs, new_prs);
> -
> - if (err)
> - return err;
> - }
> -
> /*
> * Change the parent's effective_cpus & effective_xcpus (top cpuset
> * only).
> @@ -2063,9 +2029,6 @@ static int update_parent_effective_cpumask(struct cpuset *cs, int cmd,
>
> spin_unlock_irq(&callback_lock);
>
> - if ((old_prs != new_prs) && (cmd == partcmd_update))
> - update_partition_exclusive_flag(cs, new_prs);
> -
> if (adding || deleting) {
> cpuset_update_tasks_cpumask(parent, tmp->addmask);
> update_sibling_cpumasks(parent, cs, tmp);
> @@ -2942,10 +2905,6 @@ static int update_prstate(struct cpuset *cs, int new_prs)
> if (alloc_tmpmasks(&tmpmask))
> return -ENOMEM;
>
> - err = update_partition_exclusive_flag(cs, new_prs);
> - if (err)
> - goto out;
> -
> if (!old_prs) {
> /*
> * cpus_allowed and exclusive_cpus cannot be both empty.
> @@ -3009,13 +2968,10 @@ static int update_prstate(struct cpuset *cs, int new_prs)
> }
> out:
> /*
> - * Make partition invalid & disable CS_CPU_EXCLUSIVE if an error
> - * happens.
> + * Make partition invalid if an error happens.
> */
> - if (err) {
> + if (err)
> new_prs = -new_prs;
> - update_partition_exclusive_flag(cs, new_prs);
> - }
>
> spin_lock_irq(&callback_lock);
> cs->partition_root_state = new_prs;
Nice.
Reviewed-by: Ridong Chen <ridong.chen@linux.dev>
--
Best regards
Ridong
^ permalink raw reply [flat|nested] 8+ messages in thread
* Re: [PATCH-next v2 1/2] cgroup/cpuset: Run SCHED_DEADLINE shrink test on valid partition root only
2026-09-27 21:53 ` [PATCH-next v2 1/2] " Waiman Long
2026-09-28 7:46 ` Ridong Chen
@ 2026-09-28 9:32 ` Guopeng Zhang
1 sibling, 0 replies; 8+ messages in thread
From: Guopeng Zhang @ 2026-09-28 9:32 UTC (permalink / raw)
To: Waiman Long, Ridong Chen, Tejun Heo, Johannes Weiner, Michal Koutný
Cc: cgroups, linux-kernel, Hui Peng
在 2026/9/28 05:53, Waiman Long 写道:
> Commit f82f80426f7a ("sched/deadline: Ensure that updates to exclusive
> cpusets don't break AC") adds a check in validate_change() to make
> sure that there is enough bandwidth for SCHED_DEADLINE tasks if we
> shrink a v1 exclusive cpuset that has CS_CPU_EXCLUSIVE flag set.
>
> With the introduction of cpuset partition in cgroup v2, we keep setting
> the CS_CPU_EXCLUSIVE flag for a partition root so that the SCHED_DEADLINE
> check will continue to work as intended. However it turns out that the
> current code isn't perfect and there are cases where a cpuset isn't
> a valid partition root, but the exclusive flag is still incorrectly
> set. This can leads to SCHED_DEADLINE check being incorrectly triggered
> when there are deadline tasks in the system. This can result in unexpected
> -EBUSY failure when making changes to cpuset control files. Fix that
> by checking for a valid partition root for v2 and is_cpu_exclusive()
> for v1. It is far easier and less cumbersome than to make sure that
> the exclusive flag is only set for valid partition roots.
>
> Even though commit a86ce68078b2 ("cgroup/cpuset: Extract out
> CS_CPU_EXCLUSIVE & CS_SCHED_LOAD_BALANCE handling") is marked as a
> commit to be fixed, the problem may exist before that.
>
> Fixes: a86ce68078b2 ("cgroup/cpuset: Extract out CS_CPU_EXCLUSIVE & CS_SCHED_LOAD_BALANCE handling")
> Signed-off-by: Waiman Long <longman@redhat.com>
> ---
> kernel/cgroup/cpuset.c | 7 ++++---
> 1 file changed, 4 insertions(+), 3 deletions(-)
>
> diff --git a/kernel/cgroup/cpuset.c b/kernel/cgroup/cpuset.c
> index 753aa65afcd7..104fe10c336d 100644
> --- a/kernel/cgroup/cpuset.c
> +++ b/kernel/cgroup/cpuset.c
> @@ -771,8 +771,8 @@ static int validate_change(struct cpuset *cur, struct cpuset *trial)
> * For v1, effective_cpus == cpus_allowed & user_xcpus() returns
> * cpus_allowed.
> *
> - * For v2, is_cpu_exclusive() & is_sched_load_balance() are true only
> - * for non-isolated partition root. At this point, the target
> + * For v2, is_partition_valid(cur) & is_sched_load_balance() are true
> + * only for non-isolated partition root. At this point, the target
> * effective_cpus isn't computed yet. user_xcpus() is the best
> * approximation.
> *
> @@ -781,7 +781,8 @@ static int validate_change(struct cpuset *cur, struct cpuset *trial)
> * becomes an issue.
> */
> ret = -EBUSY;
> - if (is_cpu_exclusive(cur) && is_sched_load_balance(cur) &&
> + if ((is_partition_valid(cur) || (!cpuset_v2() && is_cpu_exclusive(cur))) &&
> + is_sched_load_balance(cur) &&
> !cpuset_cpumask_can_shrink(cur->effective_cpus, user_xcpus(trial)))
> goto out;
>
Reviewed-by: Guopeng Zhang <zhangguopeng@kylinos.cn>
Thanks,
Guopeng
^ permalink raw reply [flat|nested] 8+ messages in thread
* Re: [PATCH-next v2 2/2] cgroup/cpuset: Remove CS_CPU_EXCLUSIVE handling code from v2
2026-09-27 21:53 ` [PATCH-next v2 2/2] cgroup/cpuset: Remove CS_CPU_EXCLUSIVE handling code from v2 Waiman Long
2026-09-28 7:53 ` Ridong Chen
@ 2026-09-28 9:32 ` Guopeng Zhang
1 sibling, 0 replies; 8+ messages in thread
From: Guopeng Zhang @ 2026-09-28 9:32 UTC (permalink / raw)
To: Waiman Long, Ridong Chen, Tejun Heo, Johannes Weiner, Michal Koutný
Cc: cgroups, linux-kernel, Hui Peng
在 2026/9/28 05:53, Waiman Long 写道:
> As the is_cpu_exclusive() function is only used for DEADLINE shrink
> test with v1 there is no need to have the CS_CPU_EXCLUSIVE flag set on
> valid partition root anymore. Remove update_partition_exclusive_flag()
> and other CS_CPU_EXCLUSIVE flag handling code in cpuset.c.
>
> Signed-off-by: Waiman Long <longman@redhat.com>
> ---
> kernel/cgroup/cpuset.c | 52 ++++--------------------------------------
> 1 file changed, 4 insertions(+), 48 deletions(-)
>
> diff --git a/kernel/cgroup/cpuset.c b/kernel/cgroup/cpuset.c
> index 104fe10c336d..4a915da37bb3 100644
> --- a/kernel/cgroup/cpuset.c
> +++ b/kernel/cgroup/cpuset.c
> @@ -1174,25 +1174,6 @@ enum partition_cmd {
> static void update_sibling_cpumasks(struct cpuset *parent, struct cpuset *cs,
> struct tmpmasks *tmp);
>
> -/*
> - * Update partition exclusive flag
> - *
> - * Return: 0 if successful, an error code otherwise
> - */
> -static int update_partition_exclusive_flag(struct cpuset *cs, int new_prs)
> -{
> - bool exclusive = (new_prs > PRS_MEMBER);
> -
> - if (exclusive && !is_cpu_exclusive(cs)) {
> - if (cpuset_update_flag(CS_CPU_EXCLUSIVE, cs, 1))
> - return PERR_NOTEXCL;
> - } else if (!exclusive && is_cpu_exclusive(cs)) {
> - /* Turning off CS_CPU_EXCLUSIVE will not return error */
> - cpuset_update_flag(CS_CPU_EXCLUSIVE, cs, 0);
> - }
> - return 0;
> -}
> -
> /*
> * Update partition load balance flag and/or rebuild sched domain
> *
> @@ -1248,11 +1229,9 @@ static void reset_partition_data(struct cpuset *cs)
>
> lockdep_assert_held(&callback_lock);
>
> - if (cpumask_empty(cs->exclusive_cpus)) {
> + if (cpumask_empty(cs->exclusive_cpus))
> cpumask_clear(cs->effective_xcpus);
> - if (is_cpu_exclusive(cs))
> - clear_bit(CS_CPU_EXCLUSIVE, &cs->flags);
> - }
> +
> if (!cpumask_and(cs->effective_cpus, parent->effective_cpus, cs->cpus_allowed))
> cpumask_copy(cs->effective_cpus, parent->effective_cpus);
> }
> @@ -2028,19 +2007,6 @@ static int update_parent_effective_cpumask(struct cpuset *cs, int cmd,
> if (!adding && !deleting && (new_prs == old_prs))
> return 0;
>
> - /*
> - * Transitioning between invalid to valid or vice versa may require
> - * changing CS_CPU_EXCLUSIVE. In the case of partcmd_update,
> - * validate_change() has already been successfully called and
> - * CPU lists in cs haven't been updated yet. So defer it to later.
> - */
> - if ((old_prs != new_prs) && (cmd != partcmd_update)) {
> - int err = update_partition_exclusive_flag(cs, new_prs);
> -
> - if (err)
> - return err;
> - }
> -
> /*
> * Change the parent's effective_cpus & effective_xcpus (top cpuset
> * only).
> @@ -2063,9 +2029,6 @@ static int update_parent_effective_cpumask(struct cpuset *cs, int cmd,
>
> spin_unlock_irq(&callback_lock);
>
> - if ((old_prs != new_prs) && (cmd == partcmd_update))
> - update_partition_exclusive_flag(cs, new_prs);
> -
> if (adding || deleting) {
> cpuset_update_tasks_cpumask(parent, tmp->addmask);
> update_sibling_cpumasks(parent, cs, tmp);
> @@ -2942,10 +2905,6 @@ static int update_prstate(struct cpuset *cs, int new_prs)
> if (alloc_tmpmasks(&tmpmask))
> return -ENOMEM;
>
> - err = update_partition_exclusive_flag(cs, new_prs);
> - if (err)
> - goto out;
> -
> if (!old_prs) {
> /*
> * cpus_allowed and exclusive_cpus cannot be both empty.
> @@ -3009,13 +2968,10 @@ static int update_prstate(struct cpuset *cs, int new_prs)
> }
> out:
> /*
> - * Make partition invalid & disable CS_CPU_EXCLUSIVE if an error
> - * happens.
> + * Make partition invalid if an error happens.
> */
> - if (err) {
> + if (err)
> new_prs = -new_prs;
> - update_partition_exclusive_flag(cs, new_prs);
> - }
>
> spin_lock_irq(&callback_lock);
> cs->partition_root_state = new_prs;
Reviewed-by: Guopeng Zhang <zhangguopeng@kylinos.cn>
Thanks,
Guopeng
^ permalink raw reply [flat|nested] 8+ messages in thread
* Re: [PATCH-next v2 0/2] cgroup/cpuset: Run SCHED_DEADLINE shrink test on valid partition root only
2026-09-27 21:53 [PATCH-next v2 0/2] cgroup/cpuset: Run SCHED_DEADLINE shrink test on valid partition root only Waiman Long
2026-09-27 21:53 ` [PATCH-next v2 1/2] " Waiman Long
2026-09-27 21:53 ` [PATCH-next v2 2/2] cgroup/cpuset: Remove CS_CPU_EXCLUSIVE handling code from v2 Waiman Long
@ 2026-09-28 17:41 ` Tejun Heo
2 siblings, 0 replies; 8+ messages in thread
From: Tejun Heo @ 2026-09-28 17:41 UTC (permalink / raw)
To: Waiman Long
Cc: Ridong Chen, Johannes Weiner, Michal Koutný,
Hui Peng, Guopeng Zhang, cgroups, linux-kernel
> Waiman Long (2):
> cgroup/cpuset: Run SCHED_DEADLINE shrink test on valid partition root
> only
> cgroup/cpuset: Remove CS_CPU_EXCLUSIVE handling code from v2
Applied 1-2 to cgroup/for-7.4.
Thanks.
--
tejun
^ permalink raw reply [flat|nested] 8+ messages in thread
end of thread, other threads:[~2026-09-28 17:41 UTC | newest]
Thread overview: 8+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2026-09-27 21:53 [PATCH-next v2 0/2] cgroup/cpuset: Run SCHED_DEADLINE shrink test on valid partition root only Waiman Long
2026-09-27 21:53 ` [PATCH-next v2 1/2] " Waiman Long
2026-09-28 7:46 ` Ridong Chen
2026-09-28 9:32 ` Guopeng Zhang
2026-09-27 21:53 ` [PATCH-next v2 2/2] cgroup/cpuset: Remove CS_CPU_EXCLUSIVE handling code from v2 Waiman Long
2026-09-28 7:53 ` Ridong Chen
2026-09-28 9:32 ` Guopeng Zhang
2026-09-28 17:41 ` [PATCH-next v2 0/2] cgroup/cpuset: Run SCHED_DEADLINE shrink test on valid partition root only Tejun Heo
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox
all inboxes | Powered by JetHome®