Re: [PATCH v2] sched/core: fix illegal RCU from offline CPUs

From: Qian Cai
Date: Mon Jan 20 2020 - 15:40:13 EST




> On Jan 20, 2020, at 5:17 AM, Peter Zijlstra <peterz@xxxxxxxxxxxxx> wrote:
>
> Bah.. that's horrible. Surely we can find a better place to do this in
> the whole hotplug machinery.
>
> Perhaps you can have takedown_cpu() do the mmdrop()?

The problem is that no all arch_cpu_idle_dead() will call idle_task_exit(). For example, alpha and parisc are not, so it needs to deal with some kind of ifdef dance in takedown_cpu() to conditionally call mmdrop() which sounds even more horrible?

If you really prefer it anyway, maybe something like touching every archâs __cpu_die() to also call mmdrop() depends on arches?

BTW, how to obtain the other CPUâs current task mm? Is that cpu_rq(cpu)->curr->active_mm?