mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
* [PATCH] cgroup/cpuset: Defer sched domain rebuild to common unlock path
@ 2026-09-18 10:27 Guopeng Zhang
  2026-09-18 10:41 ` Ridong Chen
  2026-09-20  3:26 ` Ridong Chen
  0 siblings, 2 replies; 5+ messages in thread
From: Guopeng Zhang @ 2026-09-18 10:27 UTC (permalink / raw)
  To: Waiman Long, Ridong Chen
  Cc: Tejun Heo, Johannes Weiner, Michal Koutný,
	cgroups, linux-kernel, Guopeng Zhang

From: Guopeng Zhang <zhangguopeng@kylinos.cn>

Both callers of update_prstate(), cpuset_partition_write() and
cpuset_css_killed(), call cpuset_update_sd_hk_unlock() immediately
afterwards. That helper rebuilds sched domains when force_sd_rebuild is
set before releasing the cpuset locks, so the check in update_prstate()
is redundant.

Commit 3bfe47967191 ("cgroup/cpuset: Move
housekeeping_update()/rebuild_sched_domains() together") removed the
same check from cpuset_write_resmask(). Remove the remaining one from
update_prstate().

Signed-off-by: Guopeng Zhang <zhangguopeng@kylinos.cn>
---
 kernel/cgroup/cpuset.c | 2 --
 1 file changed, 2 deletions(-)

diff --git a/kernel/cgroup/cpuset.c b/kernel/cgroup/cpuset.c
index 8f24171..d58ecf5 100644
--- a/kernel/cgroup/cpuset.c
+++ b/kernel/cgroup/cpuset.c
@@ -3039,8 +3039,6 @@ out:
 	update_partition_sd_lb(cs, old_prs);
 
 	notify_partition_change(cs, old_prs);
-	if (force_sd_rebuild)
-		rebuild_sched_domains_locked();
 	free_tmpmasks(&tmpmask);
 	return 0;
 }
-- 
2.43.0


^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: [PATCH] cgroup/cpuset: Defer sched domain rebuild to common unlock path
  2026-09-18 10:27 [PATCH] cgroup/cpuset: Defer sched domain rebuild to common unlock path Guopeng Zhang
@ 2026-09-18 10:41 ` Ridong Chen
  2026-09-20  2:26   ` Guopeng Zhang
  2026-09-20  3:26 ` Ridong Chen
  1 sibling, 1 reply; 5+ messages in thread
From: Ridong Chen @ 2026-09-18 10:41 UTC (permalink / raw)
  To: Guopeng Zhang, Waiman Long
  Cc: Tejun Heo, Johannes Weiner, Michal Koutný,
	cgroups, linux-kernel, Guopeng Zhang



On 9/18/2026 6:27 PM, Guopeng Zhang wrote:
> From: Guopeng Zhang <zhangguopeng@kylinos.cn>
> 
> Both callers of update_prstate(), cpuset_partition_write() and
> cpuset_css_killed(), call cpuset_update_sd_hk_unlock() immediately
> afterwards. That helper rebuilds sched domains when force_sd_rebuild is
> set before releasing the cpuset locks, so the check in update_prstate()
> is redundant.
> 
> Commit 3bfe47967191 ("cgroup/cpuset: Move
> housekeeping_update()/rebuild_sched_domains() together") removed the
> same check from cpuset_write_resmask(). Remove the remaining one from
> update_prstate().
> 
> Signed-off-by: Guopeng Zhang <zhangguopeng@kylinos.cn>
> ---
>   kernel/cgroup/cpuset.c | 2 --
>   1 file changed, 2 deletions(-)
> 
> diff --git a/kernel/cgroup/cpuset.c b/kernel/cgroup/cpuset.c
> index 8f24171..d58ecf5 100644
> --- a/kernel/cgroup/cpuset.c
> +++ b/kernel/cgroup/cpuset.c
> @@ -3039,8 +3039,6 @@ out:
>   	update_partition_sd_lb(cs, old_prs);
>   
>   	notify_partition_change(cs, old_prs);
> -	if (force_sd_rebuild)
> -		rebuild_sched_domains_locked();
>   	free_tmpmasks(&tmpmask);
>   	return 0;
>   }

This title is confusing. I thought you were doing some async work, what does 
"defer" mean here? In fact, it just removes a piece of redundant code.

-- 
Best regards
Ridong


^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: [PATCH] cgroup/cpuset: Defer sched domain rebuild to common unlock path
  2026-09-18 10:41 ` Ridong Chen
@ 2026-09-20  2:26   ` Guopeng Zhang
  0 siblings, 0 replies; 5+ messages in thread
From: Guopeng Zhang @ 2026-09-20  2:26 UTC (permalink / raw)
  To: Ridong Chen, Waiman Long
  Cc: Tejun Heo, Johannes Weiner, Michal Koutný,
	cgroups, linux-kernel, Guopeng Zhang



在 2026/9/18 18:41, Ridong Chen 写道:
> 
> 
> On 9/18/2026 6:27 PM, Guopeng Zhang wrote:
>> From: Guopeng Zhang <zhangguopeng@kylinos.cn>
>>
>> Both callers of update_prstate(), cpuset_partition_write() and
>> cpuset_css_killed(), call cpuset_update_sd_hk_unlock() immediately
>> afterwards. That helper rebuilds sched domains when force_sd_rebuild is
>> set before releasing the cpuset locks, so the check in update_prstate()
>> is redundant.
>>
>> Commit 3bfe47967191 ("cgroup/cpuset: Move
>> housekeeping_update()/rebuild_sched_domains() together") removed the
>> same check from cpuset_write_resmask(). Remove the remaining one from
>> update_prstate().
>>
>> Signed-off-by: Guopeng Zhang <zhangguopeng@kylinos.cn>
>> ---
>>   kernel/cgroup/cpuset.c | 2 --
>>   1 file changed, 2 deletions(-)
>>
>> diff --git a/kernel/cgroup/cpuset.c b/kernel/cgroup/cpuset.c
>> index 8f24171..d58ecf5 100644
>> --- a/kernel/cgroup/cpuset.c
>> +++ b/kernel/cgroup/cpuset.c
>> @@ -3039,8 +3039,6 @@ out:
>>       update_partition_sd_lb(cs, old_prs);
>>         notify_partition_change(cs, old_prs);
>> -    if (force_sd_rebuild)
>> -        rebuild_sched_domains_locked();
>>       free_tmpmasks(&tmpmask);
>>       return 0;
>>   }
> 
> This title is confusing. I thought you were doing some async work, what does "defer" mean here? In fact, it just removes a piece of redundant code.
> 

Thanks for the review.

I misunderstood this. I used "Defer" because the rebuild still happens later in cpuset_update_sd_hk_unlock().

You're right, the title is confusing. I'll fix it in v2.

Thanks,
Guopeng



^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: [PATCH] cgroup/cpuset: Defer sched domain rebuild to common unlock path
  2026-09-18 10:27 [PATCH] cgroup/cpuset: Defer sched domain rebuild to common unlock path Guopeng Zhang
  2026-09-18 10:41 ` Ridong Chen
@ 2026-09-20  3:26 ` Ridong Chen
  2026-09-20  3:28   ` Ridong Chen
  1 sibling, 1 reply; 5+ messages in thread
From: Ridong Chen @ 2026-09-20  3:26 UTC (permalink / raw)
  To: Guopeng Zhang, Waiman Long
  Cc: Tejun Heo, Johannes Weiner, Michal Koutný,
	cgroups, linux-kernel, Guopeng Zhang



On 9/18/2026 6:27 PM, Guopeng Zhang wrote:
> From: Guopeng Zhang <zhangguopeng@kylinos.cn>
> 
> Both callers of update_prstate(), cpuset_partition_write() and
> cpuset_css_killed(), call cpuset_update_sd_hk_unlock() immediately
> afterwards. That helper rebuilds sched domains when force_sd_rebuild is
> set before releasing the cpuset locks, so the check in update_prstate()
> is redundant.
> 
> Commit 3bfe47967191 ("cgroup/cpuset: Move
> housekeeping_update()/rebuild_sched_domains() together") removed the
> same check from cpuset_write_resmask(). Remove the remaining one from
> update_prstate().
> 
> Signed-off-by: Guopeng Zhang <zhangguopeng@kylinos.cn>
> ---
>   kernel/cgroup/cpuset.c | 2 --
>   1 file changed, 2 deletions(-)
> 
> diff --git a/kernel/cgroup/cpuset.c b/kernel/cgroup/cpuset.c
> index 8f24171..d58ecf5 100644
> --- a/kernel/cgroup/cpuset.c
> +++ b/kernel/cgroup/cpuset.c
> @@ -3039,8 +3039,6 @@ out:
>   	update_partition_sd_lb(cs, old_prs);
>   
>   	notify_partition_change(cs, old_prs);
> -	if (force_sd_rebuild)
> -		rebuild_sched_domains_locked();
>   	free_tmpmasks(&tmpmask);
>   	return 0;
>   }

Reviewed-by: Ridong Chen <ridong.chen@linux.dev>
Thanks.
-- 
Best regards
Ridong


^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: [PATCH] cgroup/cpuset: Defer sched domain rebuild to common unlock path
  2026-09-20  3:26 ` Ridong Chen
@ 2026-09-20  3:28   ` Ridong Chen
  0 siblings, 0 replies; 5+ messages in thread
From: Ridong Chen @ 2026-09-20  3:28 UTC (permalink / raw)
  To: Guopeng Zhang, Waiman Long
  Cc: Tejun Heo, Johannes Weiner, Michal Koutný,
	cgroups, linux-kernel, Guopeng Zhang



On 9/20/2026 11:26 AM, Ridong Chen wrote:
> 
> 
> On 9/18/2026 6:27 PM, Guopeng Zhang wrote:
>> From: Guopeng Zhang <zhangguopeng@kylinos.cn>
>>
>> Both callers of update_prstate(), cpuset_partition_write() and
>> cpuset_css_killed(), call cpuset_update_sd_hk_unlock() immediately
>> afterwards. That helper rebuilds sched domains when force_sd_rebuild is
>> set before releasing the cpuset locks, so the check in update_prstate()
>> is redundant.
>>
>> Commit 3bfe47967191 ("cgroup/cpuset: Move
>> housekeeping_update()/rebuild_sched_domains() together") removed the
>> same check from cpuset_write_resmask(). Remove the remaining one from
>> update_prstate().
>>
>> Signed-off-by: Guopeng Zhang <zhangguopeng@kylinos.cn>
>> ---
>>   kernel/cgroup/cpuset.c | 2 --
>>   1 file changed, 2 deletions(-)
>>
>> diff --git a/kernel/cgroup/cpuset.c b/kernel/cgroup/cpuset.c
>> index 8f24171..d58ecf5 100644
>> --- a/kernel/cgroup/cpuset.c
>> +++ b/kernel/cgroup/cpuset.c
>> @@ -3039,8 +3039,6 @@ out:
>>       update_partition_sd_lb(cs, old_prs);
>>       notify_partition_change(cs, old_prs);
>> -    if (force_sd_rebuild)
>> -        rebuild_sched_domains_locked();
>>       free_tmpmasks(&tmpmask);
>>       return 0;
>>   }
> 
> Reviewed-by: Ridong Chen <ridong.chen@linux.dev>
> Thanks.

Sorry, this was sent by mistake.

-- 
Best regards
Ridong


^ permalink raw reply	[flat|nested] 5+ messages in thread

end of thread, other threads:[~2026-09-20  3:28 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2026-09-18 10:27 [PATCH] cgroup/cpuset: Defer sched domain rebuild to common unlock path Guopeng Zhang
2026-09-18 10:41 ` Ridong Chen
2026-09-20  2:26   ` Guopeng Zhang
2026-09-20  3:26 ` Ridong Chen
2026-09-20  3:28   ` Ridong Chen

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®