[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] [Xen-changelog] [xen staging] xen/arm: Free memory allocated for sibling/core maps on CPU hot-unplug
commit 517e58d610443c9e68ae5687b450d515b4f8c6e3 Author: Mirela Simonovic <mirela.simonovic@xxxxxxxxxx> AuthorDate: Fri Jun 1 15:17:49 2018 +0200 Commit: Julien Grall <julien.grall@xxxxxxx> CommitDate: Tue Jun 5 19:08:05 2018 +0100 xen/arm: Free memory allocated for sibling/core maps on CPU hot-unplug 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 when the CPU dies. The call to remove_cpu_sibling_map() is made from a notifier callback when CPU_DEAD event is received. Signed-off-by: Mirela Simonovic <mirela.simonovic@xxxxxxxxxx> Acked-by: Julien Grall <julien.grall@xxxxxxx> --- xen/arch/arm/smpboot.c | 36 ++++++++++++++++++++++++++++++++++++ 1 file changed, 36 insertions(+) diff --git a/xen/arch/arm/smpboot.c b/xen/arch/arm/smpboot.c index ad1f6b751b..cf3a4ce659 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) { @@ -499,6 +505,36 @@ void __cpu_die(unsigned int cpu) smp_mb(); } +static int cpu_smpboot_callback(struct notifier_block *nfb, + unsigned long action, + void *hcpu) +{ + unsigned int cpu = (unsigned long)hcpu; + + switch ( action ) + { + case CPU_DEAD: + remove_cpu_sibling_map(cpu); + break; + default: + break; + } + + return NOTIFY_DONE; +} + +static struct notifier_block cpu_smpboot_nfb = { + .notifier_call = cpu_smpboot_callback, +}; + +static int __init cpu_smpboot_notifier_init(void) +{ + register_cpu_notifier(&cpu_smpboot_nfb); + + return 0; +} +presmp_initcall(cpu_smpboot_notifier_init); + /* * Local variables: * mode: C -- generated by git-patchbot for /home/xen/git/xen.git#staging _______________________________________________ Xen-changelog mailing list Xen-changelog@xxxxxxxxxxxxxxxxxxxx https://lists.xenproject.org/xen-changelog
|
Lists.xenproject.org is hosted with RackSpace, monitoring our |