Re: [PATCH] x86, cpu: Fix node state for whether it contains CPU

From: Tim Chen
Date: Mon Aug 29 2016 - 13:49:01 EST


On Mon, 2016-08-29 at 15:36 +0200, Peter Zijlstra wrote:
> On Wed, Aug 24, 2016 at 04:26:49PM -0700, Tim Chen wrote:
>
> >
> > Signed-off-by: Tim Chen <tim.c.chen@xxxxxxxxxxxxxxx>
> > ---
> > Âarch/x86/kernel/smpboot.c | 1 +
> > Â1 file changed, 1 insertion(+)
> >
> > diff --git a/arch/x86/kernel/smpboot.c b/arch/x86/kernel/smpboot.c
> > index d8f7d01..04c0574 100644
> > --- a/arch/x86/kernel/smpboot.c
> > +++ b/arch/x86/kernel/smpboot.c
> > @@ -259,6 +259,7 @@ static void notrace start_secondary(void *unused)
> > Â lock_vector_lock();
> > Â setup_vector_irq(smp_processor_id());
> > Â set_cpu_online(smp_processor_id(), true);
> > + node_set_state(cpu_to_node(smp_processor_id()), N_CPU);
> > Â unlock_vector_lock();
> > Â cpu_set_state_online(smp_processor_id());
> > Â x86_platform.nmi_init();
> Would it not be easier to register the vmstat_notifier earlier, before
> SMP bringup? Because with this change, we need to go fix all
> architectures.

I think checking all nodes for online cpus when we init vmstat
is probably the more straightforward way to go. We can do this after
SMP bring up. I'll update the patch for that.

Thanks.

Tim