Skip to contentSkip to conversation

cgroup/cpuset: Defer sched domain rebuild to common unlock path

PATCH In review Guopeng Zhang 2 participants 5 messages Sep 18 – Sep 20

Subsystems (2)
lore
Share & tools
lore
#0 lore raw

PATCH 1/1 cgroup/cpuset: Defer sched domain rebuild to common unlock path

From: Guopeng Zhang <[email protected]>

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().

---
 kernel/cgroup/cpuset.c | 2 --
 1 file changed, 2 deletions(-)
kernel/cgroup/cpuset.c +0 -2
index 8f24171..d58ecf5 100644
@@ -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;
 }
Signature · 1 line
2.43.0
reviewer
#1 lore raw
Quoted 23 lines · Guopeng Zhang

From: Guopeng Zhang <[email protected]>

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().

---
  kernel/cgroup/cpuset.c | 2 --
  1 file changed, 2 deletions(-)
kernel/cgroup/cpuset.c +0 -0
index 8f24171..d58ecf5 100644

kernel/cgroup/cpuset.c out: · line 3044

Quoted 8 lines
kernel/cgroup/cpuset.c +0 -2
@@ -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.

Signature · 2 lines
Best regards
Ridong
#2 lore raw
Quoted 21 lines · Ridong Chen
Quoted 18 lines · Guopeng Zhang

From: Guopeng Zhang <[email protected]>

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().

---
  kernel/cgroup/cpuset.c | 2 --

  1 file changed, 2 deletions(-)
Quoted 15 lines

kernel/cgroup/cpuset.c out: · line 3043

Quoted 12 lines
kernel/cgroup/cpuset.c +0 -2
index 8f24171..d58ecf5 100644
@@ -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

reviewer Reviewed-by on v1 1/1
#3 lore raw
In reply to Guopeng Zhang
Quoted 23 lines · Guopeng Zhang

From: Guopeng Zhang <[email protected]>

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().

---
  kernel/cgroup/cpuset.c | 2 --
  1 file changed, 2 deletions(-)
kernel/cgroup/cpuset.c +0 -0
index 8f24171..d58ecf5 100644

kernel/cgroup/cpuset.c out: · line 3044

Quoted 8 lines
kernel/cgroup/cpuset.c +0 -2
@@ -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;
  }

Thanks.

Signature · 2 lines
Best regards
Ridong
reviewer
#4 lore raw
Quoted 35 lines · Ridong Chen
Quoted 23 lines · Guopeng Zhang

From: Guopeng Zhang <[email protected]>

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().

---
  kernel/cgroup/cpuset.c | 2 --

  1 file changed, 2 deletions(-)
kernel/cgroup/cpuset.c +0 -0
index 8f24171..d58ecf5 100644

kernel/cgroup/cpuset.c out: · line 3043

Quoted 7 lines
kernel/cgroup/cpuset.c +0 -2
@@ -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;
   }
Quoted 1 line

Thanks.

Sorry, this was sent by mistake.

Signature · 2 lines
Best regards
Ridong