From 38fcbd3f08375eb2986b9b63ccd4f593e71aa99d Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Andreas=20F=C3=A4rber?= Date: Sun, 7 Jul 2013 19:50:23 +0200 Subject: cpu: Replace qemu_for_each_cpu() MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit It was introduced to loop over CPUs from target-independent code, but since commit 182735efaf956ccab50b6d74a4fed163e0f35660 target-independent CPUState is used. A loop can be considered more efficient than function calls in a loop, and CPU_FOREACH() hides implementation details just as well, so use that instead. Suggested-by: Markus Armbruster Acked-by: Michael S. Tsirkin Signed-off-by: Andreas Färber --- arch_init.c | 11 +++++------ 1 file changed, 5 insertions(+), 6 deletions(-) (limited to 'arch_init.c') diff --git a/arch_init.c b/arch_init.c index 0471cd5a6b..e47e1399bb 100644 --- a/arch_init.c +++ b/arch_init.c @@ -1196,15 +1196,14 @@ static void mig_sleep_cpu(void *opq) much time in the VM. The migration thread will try to catchup. Workload will experience a performance drop. */ -static void mig_throttle_cpu_down(CPUState *cpu, void *data) -{ - async_run_on_cpu(cpu, mig_sleep_cpu, NULL); -} - static void mig_throttle_guest_down(void) { + CPUState *cpu; + qemu_mutex_lock_iothread(); - qemu_for_each_cpu(mig_throttle_cpu_down, NULL); + CPU_FOREACH(cpu) { + async_run_on_cpu(cpu, mig_sleep_cpu, NULL); + } qemu_mutex_unlock_iothread(); } -- cgit v1.2.1