Re: [PATCH v2] cgroup/cpuset: Remove cpus_allowed/mems_allowed setup in cpuset_init_smp()

From: Michal Koutný
Date: Wed Apr 27 2022 - 09:53:34 EST


Hello.

On Mon, Apr 25, 2022 at 11:55:05AM -0400, Waiman Long <longman@xxxxxxxxxx> wrote:
> smp_init() is called after the first two init functions. So we don't
> have a complete list of active cpus and memory nodes until later in
> cpuset_init_smp() which is the right time to set up effective_cpus
> and effective_mems.

Yes.

setup_arch
prefill_possible_map
cpuset_init (1)
cgroup_init
cpuset_bind (2a)
...
kernel_init
kernel_init_freeable
...
cpuset_init_smp (3)
...
...
cpuset_bind (2b)


>
> diff --git a/kernel/cgroup/cpuset.c b/kernel/cgroup/cpuset.c
> index 9390bfd9f1cd..6bd8f5ef40fe 100644
> --- a/kernel/cgroup/cpuset.c
> +++ b/kernel/cgroup/cpuset.c
> @@ -3390,8 +3390,9 @@ static struct notifier_block cpuset_track_online_nodes_nb = {
> */
> void __init cpuset_init_smp(void)
> {
> - cpumask_copy(top_cpuset.cpus_allowed, cpu_active_mask);
> - top_cpuset.mems_allowed = node_states[N_MEMORY];
> + /*
> + * cpus_allowd/mems_allowed will be properly set up in cpuset_bind().
> + */

IIUC, the comment should say

> + * cpus_allowed/mems_allowed were (v2) or will be (v1) properly set up in cpuset_bind().

(nit)

Reviewed-by: Michal Koutný <mkoutny@xxxxxxxx>