From: Konrad Rzeszutek Wilk <konrad.wilk@oracle.com>
To: Bob Liu <lliubbo@gmail.com>
Cc: xen-devel@lists.xenproject.org, linux-kernel@vger.kernel.org,
james.dingwall@zynstra.com, Bob Liu <bob.liu@oracle.com>
Subject: Re: [PATCH] drivers: xen: deaggressive selfballoon driver
Date: Mon, 27 Jan 2014 10:57:42 -0500 [thread overview]
Message-ID: <20140127155742.GB22245@phenom.dumpdata.com> (raw)
In-Reply-To: <1390373864-10525-1-git-send-email-bob.liu@oracle.com>
On Wed, Jan 22, 2014 at 02:57:44PM +0800, Bob Liu wrote:
> Current xen-selfballoon driver is too aggressive which may cause OOM be
> triggered more often. Eg. this bug reported by James:
> https://lkml.org/lkml/2013/11/21/158
>
> There are two mainly reasons:
> 1) The original goal_page didn't consider some pages used by kernel space, like
> slab pages and pages used by device drivers.
>
> 2) The balloon driver may not give back memory to guest OS fast enough when the
> workload suddenly aquries a lot of physical memory.
>
> In both cases, the guest OS will suffer from memory pressure and OOM may
> be triggered.
>
> The fix is make xen-selfballoon driver not that aggressive by adding extra 10%
> of total ram pages to goal_page.
> It's more valuable to keep the guest system reliable and response faster than
> balloon out these 10% pages to XEN.
>
> Signed-off-by: Bob Liu <bob.liu@oracle.com>
Looks OK to me.
> ---
> drivers/xen/xen-selfballoon.c | 22 ++++++++++++++++++++++
> 1 file changed, 22 insertions(+)
>
> diff --git a/drivers/xen/xen-selfballoon.c b/drivers/xen/xen-selfballoon.c
> index 21e18c1..745ad79 100644
> --- a/drivers/xen/xen-selfballoon.c
> +++ b/drivers/xen/xen-selfballoon.c
> @@ -175,6 +175,7 @@ static void frontswap_selfshrink(void)
> #endif /* CONFIG_FRONTSWAP */
>
> #define MB2PAGES(mb) ((mb) << (20 - PAGE_SHIFT))
> +#define PAGES2MB(pages) ((pages) >> (20 - PAGE_SHIFT))
>
> /*
> * Use current balloon size, the goal (vm_committed_as), and hysteresis
> @@ -525,6 +526,7 @@ EXPORT_SYMBOL(register_xen_selfballooning);
> int xen_selfballoon_init(bool use_selfballooning, bool use_frontswap_selfshrink)
> {
> bool enable = false;
> + unsigned long reserve_pages;
>
> if (!xen_domain())
> return -ENODEV;
> @@ -549,6 +551,26 @@ int xen_selfballoon_init(bool use_selfballooning, bool use_frontswap_selfshrink)
> if (!enable)
> return -ENODEV;
>
> + /*
> + * Give selfballoon_reserved_mb a default value(10% of total ram pages)
> + * to make selfballoon not so aggressive.
> + *
> + * There are mainly two reasons:
> + * 1) The original goal_page didn't consider some pages used by kernel
> + * space, like slab pages and memory used by device drivers.
> + *
> + * 2) The balloon driver may not give back memory to guest OS fast
> + * enough when the workload suddenly aquries a lot of physical memory.
> + *
> + * In both cases, the guest OS will suffer from memory pressure and
> + * OOM killer may be triggered.
> + * By reserving extra 10% of total ram pages, we can keep the system
> + * much more reliably and response faster in some cases.
> + */
> + if (!selfballoon_reserved_mb) {
> + reserve_pages = totalram_pages / 10;
> + selfballoon_reserved_mb = PAGES2MB(reserve_pages);
> + }
> schedule_delayed_work(&selfballoon_worker, selfballoon_interval * HZ);
>
> return 0;
> --
> 1.7.10.4
>
next prev parent reply other threads:[~2014-01-27 15:57 UTC|newest]
Thread overview: 4+ messages / expand[flat|nested] mbox.gz Atom feed top
2014-01-22 6:57 [PATCH] drivers: xen: deaggressive selfballoon driver Bob Liu
2014-01-27 15:57 ` Konrad Rzeszutek Wilk
2014-01-27 15:57 ` Konrad Rzeszutek Wilk [this message]
-- strict thread matches above, loose matches on Subject: below --
2014-01-22 6:57 Bob Liu
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=20140127155742.GB22245@phenom.dumpdata.com \
--to=konrad.wilk@oracle.com \
--cc=bob.liu@oracle.com \
--cc=james.dingwall@zynstra.com \
--cc=linux-kernel@vger.kernel.org \
--cc=lliubbo@gmail.com \
--cc=xen-devel@lists.xenproject.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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.