Re: [PATCH v2 3/3] mm/page_alloc: Keep memoryless cpuless node 0 offline

From: Michal Hocko
Date: Mon May 04 2020 - 05:37:18 EST


On Thu 30-04-20 12:48:20, Srikar Dronamraju wrote:
> * Michal Hocko <mhocko@xxxxxxxxxx> [2020-04-29 14:22:11]:
>
> > On Wed 29-04-20 07:11:45, Srikar Dronamraju wrote:
> > > > >
> > > > > By marking, N_ONLINE as NODE_MASK_NONE, lets stop assuming that Node 0 is
> > > > > always online.
> > > > >
> > > > > ...
> > > > >
> > > > > --- a/mm/page_alloc.c
> > > > > +++ b/mm/page_alloc.c
> > > > > @@ -116,8 +116,10 @@ EXPORT_SYMBOL(latent_entropy);
> > > > > */
> > > > > nodemask_t node_states[NR_NODE_STATES] __read_mostly = {
> > > > > [N_POSSIBLE] = NODE_MASK_ALL,
> > > > > +#ifdef CONFIG_NUMA
> > > > > + [N_ONLINE] = NODE_MASK_NONE,
> > > > > +#else
> > > > > [N_ONLINE] = { { [0] = 1UL } },
> > > > > -#ifndef CONFIG_NUMA
> > > > > [N_NORMAL_MEMORY] = { { [0] = 1UL } },
> > > > > #ifdef CONFIG_HIGHMEM
> > > > > [N_HIGH_MEMORY] = { { [0] = 1UL } },
> > > >
> > > > So on all other NUMA machines, when does node 0 get marked online?
> > > >
> > > > This change means that for some time during boot, such machines will
> > > > now be running with node 0 marked as offline. What are the
> > > > implications of this? Will something break?
> > >
> > > Till the nodes are detected, marking Node 0 as online tends to be redundant.
> > > Because the system doesn't know if its a NUMA or a non-NUMA system.
> > > Once we detect the nodes, we online them immediately. Hence I don't see any
> > > side-effects or negative implications of this change.
> > >
> > > However if I am missing anything, please do let me know.
> > >
> > > >From my part, I have tested this on
> > > 1. Non-NUMA Single node but CPUs and memory coming from zero node.
> > > 2. Non-NUMA Single node but CPUs and memory coming from non-zero node.
> > > 3. NUMA Multi node but with CPUs and memory from node 0.
> > > 4. NUMA Multi node but with no CPUs and memory from node 0.
> >
> > Have you tested on something else than ppc? Each arch does the NUMA
> > setup separately and this is a big mess. E.g. x86 marks even memory less
> > nodes (see init_memory_less_node) as online.
> >
>
> while I have predominantly tested on ppc, I did test on X86 with CONFIG_NUMA
> enabled/disabled on both single node and multi node machines.
> However, I dont have a cpuless/memoryless x86 system.

This should be able to emulate inside kvm, I believe.

> > Honestly I have hard time to evaluate the effect of this patch. It makes
> > some sense to assume all nodes offline before they get online but this
> > is a land mine territory.
> >
> > I am also not sure what kind of problem this is going to address. You
> > have mentioned numa balancing without many details.
>
> 1. On a machine with just one node with node number not being 0,
> the current setup will end up showing 2 online nodes. And when there are
> more than one online nodes, numa_balancing gets enabled.
>
> Without patch
> $ grep numa /proc/vmstat
> numa_hit 95179
> numa_miss 0
> numa_foreign 0
> numa_interleave 3764
> numa_local 95179
> numa_other 0
> numa_pte_updates 1206973 <----------
> numa_huge_pte_updates 4654 <----------
> numa_hint_faults 19560 <----------
> numa_hint_faults_local 19560 <----------
> numa_pages_migrated 0
>
>
> With patch
> $ grep numa /proc/vmstat
> numa_hit 322338756
> numa_miss 0
> numa_foreign 0
> numa_interleave 3790
> numa_local 322338756
> numa_other 0
> numa_pte_updates 0 <----------
> numa_huge_pte_updates 0 <----------
> numa_hint_faults 0 <----------
> numa_hint_faults_local 0 <----------
> numa_pages_migrated 0
>
> So we have a redundant page hinting numa faults which we can avoid.

interesting. Does this lead to any observable differences? Btw. it would
be really great to describe how the online state influences the numa
balancing.

> 2. Few people have complained about existence of this dummy node when
> parsing lscpu and numactl o/p. They somehow start to think that the tools
> are reporting incorrectly or the kernel is not able to recognize resources
> connected to the node.

Please be more specific.
--
Michal Hocko
SUSE Labs