On Thu, Oct 06, 2022 at 07:09:36PM +0100, Alberto Faria wrote: > On Thu, Oct 6, 2022 at 7:00 PM Stefan Hajnoczi <stefa...@redhat.com> wrote: > > s->needs_mem_regions determines if we'll use libblkio memory regions at > > all. When it's false we skip blkio_map_mem_region() and therefore it's > > safe to set s->mem_regions_pinned to false. > > blkio_register_buf() calls blkio_map_mem_region(). Is the > bdrv_register_buf callback maybe skipped somehow when > needs_mem_regions is false?
You're right. blkio_register_buf() will be called by virtio-blk's ram block registrar even when s->needs_mem_regions is false. s->mem_regions_pinned therefore has to default to true even when s->needs_mem_regions is false. > 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. I think we can try that for now and see if the policy needs to be refined. Stefan
signature.asc
Description: PGP signature