Let's simplify the case when we only want a single thread and don't have
to mess with signal handlers.
Reviewed-by: Pankaj Gupta <pankaj.gupta@ionos.com>
Reviewed-by: Daniel P. Berrangé <berrange@redhat.com>
Reviewed-by: Michal Privoznik <mprivozn@redhat.com>
Signed-off-by: David Hildenbrand <david@redhat.com>
Message-Id: <
20211217134611.31172-6-david@redhat.com>
Reviewed-by: Michael S. Tsirkin <mst@redhat.com>
Signed-off-by: Michael S. Tsirkin <mst@redhat.com>
}
if (use_madv_populate_write) {
+ /* Avoid creating a single thread for MADV_POPULATE_WRITE */
+ if (context.num_threads == 1) {
+ if (qemu_madvise(area, hpagesize * numpages,
+ QEMU_MADV_POPULATE_WRITE)) {
+ return -errno;
+ }
+ return 0;
+ }
touch_fn = do_madv_populate_write_pages;
} else {
touch_fn = do_touch_pages;