Re: [PATCH -next] cgroup/cpuset: Statically initialize more members of top_cpuset

From: Klara Modin
Date: Tue Apr 23 2024 - 15:21:44 EST


Hi,

On 2024-04-20 11:46, Xiu Jianfeng wrote:
Initializing top_cpuset.relax_domain_level and setting
CS_SCHED_LOAD_BALANCE to top_cpuset.flags in cpuset_init() could be
completed at the time of top_cpuset definition by compiler.

Signed-off-by: Xiu Jianfeng <xiujianfeng@xxxxxxxxxx>
---
kernel/cgroup/cpuset.c | 5 ++---
1 file changed, 2 insertions(+), 3 deletions(-)

diff --git a/kernel/cgroup/cpuset.c b/kernel/cgroup/cpuset.c
index d8d3439eda4e..e70008a1d86a 100644
--- a/kernel/cgroup/cpuset.c
+++ b/kernel/cgroup/cpuset.c
@@ -369,8 +369,9 @@ static inline void notify_partition_change(struct cpuset *cs, int old_prs)
static struct cpuset top_cpuset = {
.flags = ((1 << CS_ONLINE) | (1 << CS_CPU_EXCLUSIVE) |
- (1 << CS_MEM_EXCLUSIVE)),
+ (1 << CS_MEM_EXCLUSIVE) | (1 < CS_SCHED_LOAD_BALANCE)),

You dropped a '<' for the bitwise shift, this causes bad cpu utilization for me.

.partition_root_state = PRS_ROOT,
+ .relax_domain_level = -1,
.remote_sibling = LIST_HEAD_INIT(top_cpuset.remote_sibling),
};
@@ -4309,8 +4310,6 @@ int __init cpuset_init(void)
nodes_setall(top_cpuset.effective_mems);
fmeter_init(&top_cpuset.fmeter);
- set_bit(CS_SCHED_LOAD_BALANCE, &top_cpuset.flags);
- top_cpuset.relax_domain_level = -1;
INIT_LIST_HEAD(&remote_children);
BUG_ON(!alloc_cpumask_var(&cpus_attach, GFP_KERNEL));

Kind regards,
Klara Modin# bad: [a59668a9397e7245b26e9be85d23f242ff757ae8] Add linux-next specific files for 20240423
git bisect start 'next/master'
# status: waiting for good commit(s), bad commit known
# good: [a2c63a3f3d687ac4f63bf4ffa04d7458a2db350b] Merge tag 'bcachefs-2024-04-22' of https://evilpiepirate.org/git/bcachefs
git bisect good a2c63a3f3d687ac4f63bf4ffa04d7458a2db350b
# good: [8115df4dd94f98b35888e6e91681118649298142] Merge branch 'master' of git://git.kernel.org/pub/scm/linux/kernel/git/klassert/ipsec-next.git
git bisect good 8115df4dd94f98b35888e6e91681118649298142
# good: [3ad20cddaf2963acd454d6954f65abbd02f76b8e] Merge branch 'for-next' of git://git.kernel.dk/linux-block.git
git bisect good 3ad20cddaf2963acd454d6954f65abbd02f76b8e
# good: [adec11643114960ad457d0890ebc237cff4e485f] Merge branch 'tty-next' of git://git.kernel.org/pub/scm/linux/kernel/git/gregkh/tty.git
git bisect good adec11643114960ad457d0890ebc237cff4e485f
# bad: [3d9862ccfb857aa54583f1f17953d87a013cd976] Merge branch 'next' of git://git.kernel.org/pub/scm/linux/kernel/git/shuah/linux-kselftest.git
git bisect bad 3d9862ccfb857aa54583f1f17953d87a013cd976
# bad: [121418665b07afcbcff3e154f297c2f3bdcf5608] Merge branch 'gpio/for-next' of git://git.kernel.org/pub/scm/linux/kernel/git/brgl/linux.git
git bisect bad 121418665b07afcbcff3e154f297c2f3bdcf5608
# good: [24ddee0ff8c34256891323c92beeaa3bd55a0d30] Merge tag 'stable/vduse-virtio-net' into vhost
git bisect good 24ddee0ff8c34256891323c92beeaa3bd55a0d30
# good: [f92141e18c8b466027e226f3388de15b059b6f65] Merge patch series "convert SCSI to atomic queue limits, part 1 (v3)"
git bisect good f92141e18c8b466027e226f3388de15b059b6f65
# good: [8d1e84ab0176c2d2b49fd741d6609a021ecc1d01] gpio: regmap: Use -ENOTSUPP consistently
git bisect good 8d1e84ab0176c2d2b49fd741d6609a021ecc1d01
# good: [a6b974b40f942b3e51124de588383009f6a42d2d] drivers: remoteproc: xlnx: Add Versal and Versal-NET support
git bisect good a6b974b40f942b3e51124de588383009f6a42d2d
# good: [e99fcac055b3325283d6c5c61a117651fb147686] Merge branches 'rproc-next' and 'rpmsg-next' into for-next
git bisect good e99fcac055b3325283d6c5c61a117651fb147686
# bad: [6c07b00ba1ff48fa9be0d8e084a0503fb93d4b64] Merge branch 'linux-next' of git://git.kernel.org/pub/scm/linux/kernel/git/mst/vhost.git
git bisect bad 6c07b00ba1ff48fa9be0d8e084a0503fb93d4b64
# bad: [d082aee133bf82bf52ffbbb93355cff6c4736862] Merge branch 'for-next' of git://git.kernel.org/pub/scm/linux/kernel/git/mkp/scsi.git
git bisect bad d082aee133bf82bf52ffbbb93355cff6c4736862
# good: [1a65b0084768a0106ba6f37541f7216c447e49b2] Merge branch 'togreg' of git://git.kernel.org/pub/scm/linux/kernel/git/jic23/iio.git
git bisect good 1a65b0084768a0106ba6f37541f7216c447e49b2
# good: [0425cf50f5957e54852ea8f77baadae7823c0266] Merge branch 'spmi-next' of git://git.kernel.org/pub/scm/linux/kernel/git/sboyd/spmi.git
git bisect good 0425cf50f5957e54852ea8f77baadae7823c0266
# good: [1c9e16b73166bcc89b3d64674b60943ec6142c3e] staging: vc04_services: vchiq_arm: Split driver static and runtime data
git bisect good 1c9e16b73166bcc89b3d64674b60943ec6142c3e
# good: [98f2233a5c20ca567b2db1147278fd110681b9ed] dmaengine: pl08x: Use kcalloc() instead of kzalloc()
git bisect good 98f2233a5c20ca567b2db1147278fd110681b9ed
# bad: [8996f93fc3880d000a0a0cb40c724d5830e140fd] cgroup/cpuset: Statically initialize more members of top_cpuset
git bisect bad 8996f93fc3880d000a0a0cb40c724d5830e140fd
# good: [fc29e04ae1ad4c99422c0b8ae4b43cfe99c70429] cgroup/rstat: add cgroup_rstat_lock helpers and tracepoints
git bisect good fc29e04ae1ad4c99422c0b8ae4b43cfe99c70429
# good: [15a0b5fe1ad6fbecfa6517750718089e12ee8344] cgroup: don't call cgroup1_pidlist_destroy_all() for v2
git bisect good 15a0b5fe1ad6fbecfa6517750718089e12ee8344
# good: [f71bfbe1e281a707e7766eb0a59ba056dc0f29f9] cgroup, legacy_freezer: update comment for freezer_css_offline()
git bisect good f71bfbe1e281a707e7766eb0a59ba056dc0f29f9
# good: [19fc8a896565ecebb3951664fd0eeab0a80314a1] cgroup: Avoid unnecessary looping in cgroup_no_v1()
git bisect good 19fc8a896565ecebb3951664fd0eeab0a80314a1
# first bad commit: [8996f93fc3880d000a0a0cb40c724d5830e140fd] cgroup/cpuset: Statically initialize more members of top_cpuset
From dfc9b104bb62ac7d0546be445ce6add9e6d8c2fe Mon Sep 17 00:00:00 2001
From: Klara Modin <klarasmodin@xxxxxxxxx>
Date: Tue, 23 Apr 2024 21:00:56 +0200
Subject: [PATCH] cgroup/cpuset: fix bitwise shift in top_cpuset initialization

Fixes: 8996f93fc388 ("cgroup/cpuset: Statically initialize more members of top_cpuset")
Signed-off-by: Klara Modin <klarasmodin@xxxxxxxxx>
---
kernel/cgroup/cpuset.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/kernel/cgroup/cpuset.c b/kernel/cgroup/cpuset.c
index e70008a1d86a..62d649d02f11 100644
--- a/kernel/cgroup/cpuset.c
+++ b/kernel/cgroup/cpuset.c
@@ -369,7 +369,7 @@ static inline void notify_partition_change(struct cpuset *cs, int old_prs)

static struct cpuset top_cpuset = {
.flags = ((1 << CS_ONLINE) | (1 << CS_CPU_EXCLUSIVE) |
- (1 << CS_MEM_EXCLUSIVE) | (1 < CS_SCHED_LOAD_BALANCE)),
+ (1 << CS_MEM_EXCLUSIVE) | (1 << CS_SCHED_LOAD_BALANCE)),
.partition_root_state = PRS_ROOT,
.relax_domain_level = -1,
.remote_sibling = LIST_HEAD_INIT(top_cpuset.remote_sibling),
--
2.44.0