Re: [PATCH] Do not use cpu_to_node() to find an offlined cpu'snode.

From: David Rientjes
Date: Tue Oct 09 2012 - 16:00:43 EST


On Tue, 9 Oct 2012, Wen Congyang wrote:

> I clear cpu-to-node mapping when the cpu is hotremoved. If the cpu is onlined,
> it will be offlined before clearing cpu-to-node mapping.
>
> Here is the code in driver/acpi/processor_driver.c:
> =============
> static int acpi_processor_handle_eject(struct acpi_processor *pr)
> {
> if (cpu_online(pr->id))
> cpu_down(pr->id); <========== cpu is offlined here.
>
> arch_unregister_cpu(pr->id);
> acpi_unmap_lsapic(pr->id); <========== I clear the mapping here.
> return (0);
> }
> =============
>
> The real problem is that: we don't migrate this task to another cpu when
> the cpu is offlined. I guess this task is not in running state, and it
> is not in the cpu's runqueue.
>

ACPI is not the only way to offline a cpu, this all needs to be
standardized throughout the kernel for each arch so that generic code like
sched can use cpu_to_node() in a CPU_DYING callback. The only way to do
that is by having arch callbacks to set cpu-to-node to NUMA_NO_NODE only
at CPU_DEAD.

> This patch is try to fix a bug: the kernel will be panicked after removing a
> node.
>

That's much more subtle than having a NULL pointer dereference like Tang
reports during migration.
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/