Re: [PATCH 2/2] cgroup: Remove nr_cgrps
From: kernel test robot
Date: Tue May 28 2024 - 19:12:14 EST
Hi Mercier,
kernel test robot noticed the following build warnings:
[auto build test WARNING on 6fbf71854e2ddea7c99397772fbbb3783bfe15b5]
url: https://github.com/intel-lab-lkp/linux/commits/T-J-Mercier/cgroup-Remove-nr_cgrps/20240529-004057
base: 6fbf71854e2ddea7c99397772fbbb3783bfe15b5
patch link: https://lore.kernel.org/r/20240528163750.2025330-1-tjmercier%40google.com
patch subject: [PATCH 2/2] cgroup: Remove nr_cgrps
config: arm64-defconfig (https://download.01.org/0day-ci/archive/20240529/202405290609.I4LQ4GZ3-lkp@xxxxxxxxx/config)
compiler: aarch64-linux-gcc (GCC) 13.2.0
reproduce (this is a W=1 build): (https://download.01.org/0day-ci/archive/20240529/202405290609.I4LQ4GZ3-lkp@xxxxxxxxx/reproduce)
If you fix the issue in a separate patch/commit (i.e. not just a new version of
the same patch/commit), kindly add following tags
| Reported-by: kernel test robot <lkp@xxxxxxxxx>
| Closes: https://lore.kernel.org/oe-kbuild-all/202405290609.I4LQ4GZ3-lkp@xxxxxxxxx/
All warnings (new ones prefixed by >>):
kernel/cgroup/cgroup.c: In function 'cgroup_setup_root':
>> kernel/cgroup/cgroup.c:2071:31: warning: variable 'ss' set but not used [-Wunused-but-set-variable]
2071 | struct cgroup_subsys *ss;
| ^~
vim +/ss +2071 kernel/cgroup/cgroup.c
2065
2066 int cgroup_setup_root(struct cgroup_root *root, u16 ss_mask)
2067 {
2068 LIST_HEAD(tmp_links);
2069 struct cgroup *root_cgrp = &root->cgrp;
2070 struct kernfs_syscall_ops *kf_sops;
> 2071 struct cgroup_subsys *ss;
2072 struct css_set *cset;
2073 int i, ret;
2074
2075 lockdep_assert_held(&cgroup_mutex);
2076
2077 ret = percpu_ref_init(&root_cgrp->self.refcnt, css_release,
2078 0, GFP_KERNEL);
2079 if (ret)
2080 goto out;
2081
2082 /*
2083 * We're accessing css_set_count without locking css_set_lock here,
2084 * but that's OK - it can only be increased by someone holding
2085 * cgroup_lock, and that's us. Later rebinding may disable
2086 * controllers on the default hierarchy and thus create new csets,
2087 * which can't be more than the existing ones. Allocate 2x.
2088 */
2089 ret = allocate_cgrp_cset_links(2 * css_set_count, &tmp_links);
2090 if (ret)
2091 goto cancel_ref;
2092
2093 ret = cgroup_init_root_id(root);
2094 if (ret)
2095 goto cancel_ref;
2096
2097 kf_sops = root == &cgrp_dfl_root ?
2098 &cgroup_kf_syscall_ops : &cgroup1_kf_syscall_ops;
2099
2100 root->kf_root = kernfs_create_root(kf_sops,
2101 KERNFS_ROOT_CREATE_DEACTIVATED |
2102 KERNFS_ROOT_SUPPORT_EXPORTOP |
2103 KERNFS_ROOT_SUPPORT_USER_XATTR,
2104 root_cgrp);
2105 if (IS_ERR(root->kf_root)) {
2106 ret = PTR_ERR(root->kf_root);
2107 goto exit_root_id;
2108 }
2109 root_cgrp->kn = kernfs_root_to_node(root->kf_root);
2110 WARN_ON_ONCE(cgroup_ino(root_cgrp) != 1);
2111 root_cgrp->ancestors[0] = root_cgrp;
2112
2113 ret = css_populate_dir(&root_cgrp->self);
2114 if (ret)
2115 goto destroy_root;
2116
2117 ret = cgroup_rstat_init(root_cgrp);
2118 if (ret)
2119 goto destroy_root;
2120
2121 ret = rebind_subsystems(root, ss_mask);
2122 if (ret)
2123 goto exit_stats;
2124
2125 ret = cgroup_bpf_inherit(root_cgrp);
2126 WARN_ON_ONCE(ret);
2127
2128 trace_cgroup_setup_root(root);
2129
2130 /*
2131 * There must be no failure case after here, since rebinding takes
2132 * care of subsystems' refcounts, which are explicitly dropped in
2133 * the failure exit path.
2134 */
2135 list_add_rcu(&root->root_list, &cgroup_roots);
2136 cgroup_root_count++;
2137
2138 /*
2139 * Link the root cgroup in this hierarchy into all the css_set
2140 * objects.
2141 */
2142 spin_lock_irq(&css_set_lock);
2143 hash_for_each(css_set_table, i, cset, hlist) {
2144 link_css_set(&tmp_links, cset, root_cgrp);
2145 if (css_set_populated(cset))
2146 cgroup_update_populated(root_cgrp, true);
2147 }
2148 spin_unlock_irq(&css_set_lock);
2149
2150 BUG_ON(!list_empty(&root_cgrp->self.children));
2151 do_each_subsys_mask(ss, i, ss_mask) {
2152 BUG_ON(atomic_read(&root->nr_css[i]) != 1);
2153 } while_each_subsys_mask();
2154
2155 ret = 0;
2156 goto out;
2157
2158 exit_stats:
2159 cgroup_rstat_exit(root_cgrp);
2160 destroy_root:
2161 kernfs_destroy_root(root->kf_root);
2162 root->kf_root = NULL;
2163 exit_root_id:
2164 cgroup_exit_root_id(root);
2165 cancel_ref:
2166 percpu_ref_exit(&root_cgrp->self.refcnt);
2167 out:
2168 free_cgrp_cset_links(&tmp_links);
2169 return ret;
2170 }
2171
--
0-DAY CI Kernel Test Service
https://github.com/intel/lkp-tests/wiki