From: "Michael S. Tsirkin" <mst@redhat.com>
To: Rusty Russell <rusty@rustcorp.com.au>
Cc: den@openvz.org, "Denis V. Lunev" <den@parallels.com>,
Raushaniya Maksudova <rmaksudova@parallels.com>,
virtualization@lists.linux-foundation.org
Subject: Re: [PATCH 2/2] virtio_balloon: free some memory from baloon on OOM
Date: Mon, 13 Oct 2014 10:22:01 +0300 [thread overview]
Message-ID: <20141013072201.GB10178@redhat.com> (raw)
In-Reply-To: <87iojoedq3.fsf@rustcorp.com.au>
On Mon, Oct 13, 2014 at 04:02:52PM +1030, Rusty Russell wrote:
> "Denis V. Lunev" <den@parallels.com> writes:
> > From: Raushaniya Maksudova <rmaksudova@parallels.com>
> >
> > Excessive virtio_balloon inflation can cause invocation of OOM-killer,
> > when Linux is under severe memory pressure. Various mechanisms are
> > responsible for correct virtio_balloon memory management. Nevertheless
> > it is often the case that these control tools does not have enough time
> > to react on fast changing memory load. As a result OS runs out of memory
> > and invokes OOM-killer. The balancing of memory by use of the virtio
> > balloon should not cause the termination of processes while there are
> > pages in the balloon. Now there is no way for virtio balloon driver to
> > free some memory at the last moment before some process will be get
> > killed by OOM-killer.
>
> This makes some amount of sense.
This reminds me of the balloon fs that Google once proposed.
This really needs to be controlled from host though.
At the moment host does not expect guest to deflate before
requests.
So as a minimum, add a feature bit for this. what if you want a mix of
mandatory and optional balooning? I guess we can use multiple balloons,
is that the idea?
> But I suggest a few minor changes:
>
> > +static int oom_vballoon_pages = OOM_VBALLOON_DEFAULT_PAGES;
> > +module_param(oom_vballoon_pages, int, S_IRUSR | S_IWUSR);
> > +MODULE_PARM_DESC(oom_vballoon_pages, "pages to free on OOM");
>
> Since this is already prefixed with "virtio_balloon." I suggest just
> calling it "oom_pages".
>
> > +static int virtballoon_oom_notify(struct notifier_block *self,
> > + unsigned long dummy, void *parm)
> > +{
> > + unsigned int num_freed_pages;
> > + unsigned long *freed = (unsigned long *)parm;
> > + struct virtio_balloon *vb = container_of((struct notifier_block *)self,
> > + struct virtio_balloon, nb);
>
> Why cast self here?
>
> > + num_freed_pages = leak_balloon(vb, oom_vballoon_pages);
> > + update_balloon_size(vb);
> > + *freed += num_freed_pages;
> > +
> > + return NOTIFY_OK;
> > +}
>
> Cheers,
> Rusty.
next prev parent reply other threads:[~2014-10-13 7:22 UTC|newest]
Thread overview: 10+ messages / expand[flat|nested] mbox.gz Atom feed top
2014-10-08 10:21 [PATCH 0/2] shrink virtio baloon on OOM in guest Denis V. Lunev
2014-10-08 10:21 ` [PATCH 1/2] virtio_balloon: return the amount of freed memory from leak_balloon() Denis V. Lunev
2014-10-08 10:21 ` [PATCH 2/2] virtio_balloon: free some memory from baloon on OOM Denis V. Lunev
2014-10-13 5:32 ` Rusty Russell
2014-10-13 7:01 ` Denis V. Lunev
2014-10-13 7:22 ` Michael S. Tsirkin [this message]
2014-10-13 23:44 ` Rusty Russell
2014-10-14 9:10 ` Michael S. Tsirkin
2014-10-15 5:37 ` Rusty Russell
2014-10-15 6:32 ` Denis V. Lunev
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20141013072201.GB10178@redhat.com \
--to=mst@redhat.com \
--cc=den@openvz.org \
--cc=den@parallels.com \
--cc=rmaksudova@parallels.com \
--cc=rusty@rustcorp.com.au \
--cc=virtualization@lists.linux-foundation.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).