Re: [PATCH v1 3/3] virtio-balloon: Switch back to OOM handler for VIRTIO_BALLOON_F_DEFLATE_ON_OOM

From: Michael S. Tsirkin
Date: Thu Feb 06 2020 - 04:09:48 EST


On Thu, Feb 06, 2020 at 10:05:43AM +0100, David Hildenbrand wrote:
> >> commit bf50e69f63d21091e525185c3ae761412be0ba72
> >> Author: Dave Hansen <dave@xxxxxxxxxxxxxxxxxx>
> >> Date: Thu Apr 7 10:43:25 2011 -0700
> >>
> >> virtio balloon: kill tell-host-first logic
> >>
> >> The virtio balloon driver has a VIRTIO_BALLOON_F_MUST_TELL_HOST
> >> feature bit. Whenever the bit is set, the guest kernel must
> >> always tell the host before we free pages back to the allocator.
> >> Without this feature, we might free a page (and have another
> >> user touch it) while the hypervisor is unprepared for it.
> >>
> >> But, if the bit is _not_ set, we are under no obligation to
> >> reverse the order; we're under no obligation to do _anything_.
> >> As of now, qemu-kvm defines the bit, but doesn't set it.
> >
> > Well this is not what the spec says in the end.
>
> I didn't check the spec, maybe I should do that :)
>
> > To continue that commit message:
> >
> > This patch makes the "tell host first" logic the only case. This
> > should make everybody happy, and reduce the amount of untested or
> > untestable code in the kernel.
>
> Yeah, but this comment explains that the current deflate is only in
> place, because it makes the code simpler (to support both cases). Of
> course, doing the deflate might result in performance improvements.
> (e.g., MADV_WILLNEED)
>
> >
> > you can try proposing the change to the virtio TC, see what do others
> > think.
>
> We can just drop the comment from this patch for now. The tell_host host
> not be an issue AFAIKS.

I guess it's a good idea.


> --
> Thanks,
>
> David / dhildenb