[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] [Xen-changelog] [xen staging] remove on-stack cpumask from stop_machine_run()
commit 07d650f6699f06687732ec35eb539609cd70c7d9 Author: Juergen Gross <jgross@xxxxxxxx> AuthorDate: Mon Jun 3 17:17:51 2019 +0200 Commit: Jan Beulich <jbeulich@xxxxxxxx> CommitDate: Mon Jun 3 17:17:51 2019 +0200 remove on-stack cpumask from stop_machine_run() The "allbutself" cpumask in stop_machine_run() is not needed. Instead of allocating it on the stack it can easily be avoided. Signed-off-by: Juergen Gross <jgross@xxxxxxxx> Reviewed-by: Jan Beulich <jbeulich@xxxxxxxx> Acked-by: Andrew Cooper <andrew.cooper3@xxxxxxxxxx> --- xen/common/stop_machine.c | 15 ++++++++------- 1 file changed, 8 insertions(+), 7 deletions(-) diff --git a/xen/common/stop_machine.c b/xen/common/stop_machine.c index ce6f5624c4..681b40906d 100644 --- a/xen/common/stop_machine.c +++ b/xen/common/stop_machine.c @@ -69,8 +69,8 @@ static void stopmachine_wait_state(void) int stop_machine_run(int (*fn)(void *), void *data, unsigned int cpu) { - cpumask_t allbutself; unsigned int i, nr_cpus; + unsigned int this = smp_processor_id(); int ret; BUG_ON(!local_irq_is_enabled()); @@ -79,9 +79,9 @@ int stop_machine_run(int (*fn)(void *), void *data, unsigned int cpu) if ( !get_cpu_maps() ) return -EBUSY; - cpumask_andnot(&allbutself, &cpu_online_map, - cpumask_of(smp_processor_id())); - nr_cpus = cpumask_weight(&allbutself); + nr_cpus = num_online_cpus(); + if ( cpu_online(this) ) + nr_cpus--; /* Must not spin here as the holder will expect us to be descheduled. */ if ( !spin_trylock(&stopmachine_lock) ) @@ -100,8 +100,9 @@ int stop_machine_run(int (*fn)(void *), void *data, unsigned int cpu) smp_wmb(); - for_each_cpu ( i, &allbutself ) - tasklet_schedule_on_cpu(&per_cpu(stopmachine_tasklet, i), i); + for_each_online_cpu ( i ) + if ( i != this ) + tasklet_schedule_on_cpu(&per_cpu(stopmachine_tasklet, i), i); stopmachine_set_state(STOPMACHINE_PREPARE); stopmachine_wait_state(); @@ -112,7 +113,7 @@ int stop_machine_run(int (*fn)(void *), void *data, unsigned int cpu) spin_debug_disable(); stopmachine_set_state(STOPMACHINE_INVOKE); - if ( (cpu == smp_processor_id()) || (cpu == NR_CPUS) ) + if ( (cpu == this) || (cpu == NR_CPUS) ) { ret = (*fn)(data); if ( ret ) -- 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 |