migration: Yield bitmap_mutex properly when sending/sleeping
commitf3321554ef7e3adc3be6f697185d3bd50d60e30e
authorPeter Xu <peterx@redhat.com>
Tue, 11 Oct 2022 21:55:50 +0000 (11 17:55 -0400)
committerJuan Quintela <quintela@redhat.com>
Thu, 15 Dec 2022 09:30:37 +0000 (15 10:30 +0100)
treeb977a562b1e4d62e6cd2792c3d23720c76459d4a
parenteaa238ab31d9d74ad09100b0f56dfe21f299eb30
migration: Yield bitmap_mutex properly when sending/sleeping

Don't take the bitmap mutex when sending pages, or when being throttled by
migration_rate_limit() (which is a bit tricky to call it here in ram code,
but seems still helpful).

It prepares for the possibility of concurrently sending pages in >1 threads
using the function ram_save_host_page() because all threads may need the
bitmap_mutex to operate on bitmaps, so that either sendmsg() or any kind of
qemu_sem_wait() blocking for one thread will not block the other from
progressing.

Signed-off-by: Peter Xu <peterx@redhat.com>
Reviewed-by: Juan Quintela <quintela@redhat.com>
Reviewed-by: Dr. David Alan Gilbert <dgilbert@redhat.com>
Signed-off-by: Juan Quintela <quintela@redhat.com>
migration/ram.c