On Thu, Oct 6, 2022 at 7:46 PM Stefan Hajnoczi <stefa...@redhat.com> wrote: > > Regardless, I'd say we want to map memory regions even if we don't > > strictly need to (in cases where we can do so at no additional cost), > > since that may improve performance for some drivers. > > The downside is that when s->mem_regions_pinned is true, virtio-mem and > anything else that calls ram discard cannot be used.
Hmm right, losing that functionality would probably be worse than potentially losing some performance for some drivers. Maybe a good middle point would be to call blkio_map_mem_region() in blkio_register_buf() iff s->needs_mem_regions || !s->mem_regions_pinned. Alberto