On Tue, 21 Jul 2020 at 09:22, David Hildenbrand <da...@redhat.com> wrote: > virtio-mem depends on Linux (hw/virtio/Kconfig). I guess > userfaultfd/postcopy is also not relevant in the context of SunOS. So > what remains is virtio-balloon. > > virito-balloon ideally wants to discard the actual mapped pages to free > up memory. When memory is re-accessed, a fresh page is faulted in (-> > zero-page under Linux). Now, we already have other cases where it looks > like "the balloon works" but it really doesn't. One example is using > vfio+virtio-balloon under Linux - inflating the balloon is simply a NOP, > no memory is actually discarded. > > I agree that POSIX_MADV_DONTNEED is not a proper match - different > guarantees. If SunOS cannot implement ram_block_discard_range() as > documented, we should disable it.
Could we also improve the documentation comment to make it clearer what ram_block_discard_range() is actually supposed to be doing? At the moment I don't think you can figure it out from the comments, which are a confusing mix of claiming it unmaps memory and that it zeroes it. Is the Linux-specific stuff (userfaultfd) a *requirement* for the function, or just a "this would be nice" extra and a valid implementation would be eg "zero out the memory" ? thanks -- PMM