[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [Xen-devel] [PATCH v2 09/10] xen/arm: Free memory allocated for sibling/core maps on CPU hot-unplug


On 20/04/18 13:25, Mirela Simonovic wrote:
The memory allocated in setup_cpu_sibling_map() when a CPU is hotplugged
has to be freed when the CPU is hot-unplugged. This is done in
remove_cpu_sibling_map() and called from __cpu_disable() on CPU hot-unplug.

Signed-off-by: Mirela Simonovic <mirela.simonovic@xxxxxxxxxx>

CC: Stefano Stabellini <sstabellini@xxxxxxxxxx>
CC: Julien Grall <julien.grall@xxxxxxx>
  xen/arch/arm/smpboot.c | 8 ++++++++
  1 file changed, 8 insertions(+)

diff --git a/xen/arch/arm/smpboot.c b/xen/arch/arm/smpboot.c
index b4ed479dc6..d01b51592d 100644
--- a/xen/arch/arm/smpboot.c
+++ b/xen/arch/arm/smpboot.c
@@ -89,6 +89,12 @@ static void setup_cpu_sibling_map(int cpu)
      cpumask_set_cpu(cpu, per_cpu(cpu_core_mask, cpu));
+static void remove_cpu_sibling_map(int cpu)
+    free_cpumask_var(per_cpu(cpu_sibling_mask, cpu));
+    free_cpumask_var(per_cpu(cpu_core_mask, cpu));
  void __init
  smp_clear_cpu_maps (void)
@@ -391,6 +397,8 @@ void __cpu_disable(void)
      /* It's now safe to remove this processor from the online map */
      cpumask_clear_cpu(cpu, &cpu_online_map);
+ remove_cpu_sibling_map(cpu);

I don't think this is the right place. Those cpumask might be used by the scheduler. So you want to free them only when the scheduler has been disabled.

Looking at x86, they will free them when the CPU is completely dead (see cpu_smpboot_callback). So I think a notifier would be the solution for arm as well.


      if ( cpu_disable_scheduler(cpu) )

Julien Grall

Xen-devel mailing list



Lists.xenproject.org is hosted with RackSpace, monitoring our
servers 24x7x365 and backed by RackSpace's Fanatical Support®.