From: Konrad Rzeszutek Wilk <konrad.wilk@oracle.com>
To: Dan Magenheimer <dan.magenheimer@oracle.com>
Cc: xen-devel@lists.xensource.com, Jana Saout <jana@saout.de>
Subject: Re: Self-ballooning question / cache issue
Date: Thu, 10 May 2012 10:42:37 -0400 [thread overview]
Message-ID: <20120510144237.GI26152@phenom.dumpdata.com> (raw)
In-Reply-To: <3a2da977-299d-4200-8f31-542b8a4fcb34@default>
On Wed, May 02, 2012 at 10:51:12AM -0700, Dan Magenheimer wrote:
> > From: Jana Saout [mailto:jana@saout.de]
> > Subject: Re: [Xen-devel] Self-ballooning question / cache issue
> >
>
> Hi Jana --
>
> Since you have tested this patch and have found it useful, and
> since its use is entirely optional, it is OK with me for it to
> be upstreamed at the next window. Konrad cc'ed.
>
> You will need to add a Signed-off-by line to the patch
> but other than that you can consider it
>
> Acked-by: Dan Magenheimer <dan.magenheimer@oracle.com>
Looks good. Can you resend it with the right tags to
xen-devel and lkml and to me please?
>
> > > Your idea of the tunable is interesting (and patches are always
> > > welcome!) but I am skeptical that it will solve the problem
> > > since I would guess the Linux kernel is shrinking dcache
> > > proportional to the size of the page cache. So adding more
> > > RAM with your "user-specified amount of pages that is
> > > added on top of the computed target number of pages",
> > > the RAM will still be shared across all caches and only
> > > some small portion of the added RAM will likely be used
> > > for dcache.
> >
> > That's true. In fact, I have to add about 1 GB of memory in order to
> > keep the relevant dcache / inode cache entries to stay in the cache.
> > When I do that the largest portion of memory is still eaten up by the
> > regular page cache. So this is more of a workaround than a solution,
> > but for now it works.
> >
> > I've attached the simple patch I've whipped up below.
> >
> > > However, if you have a chance to try it, I would be interested
> > > in your findings. Note that you already can set a
> > > permanent floor for selfballooning ("min_usable_mb") or,
> > > of course, just turn off selfballooning altogether.
> >
> > Sure, that's always a possibility. However, the VM already had an
> > overly large amount of memory before to avoid the problem. Now it runs
> > with less memory (still a bit more than required), and when a load spike
> > comes, it can quickly balloon up, which is exactly what I was looking
> > for.
> >
> > Jana
> >
> > ----
> > Author: Jana Saout <jana@saout.de>
> > Date: Sun Apr 29 22:09:29 2012 +0200
> >
> > Add selfballoning memory reservation tunable.
> >
> > diff --git a/drivers/xen/xen-selfballoon.c b/drivers/xen/xen-selfballoon.c
> > index 146c948..7d041cb 100644
> > --- a/drivers/xen/xen-selfballoon.c
> > +++ b/drivers/xen/xen-selfballoon.c
> > @@ -105,6 +105,12 @@ static unsigned int selfballoon_interval __read_mostly = 5;
> > */
> > static unsigned int selfballoon_min_usable_mb;
> >
> > +/*
> > + * Amount of RAM in MB to add to the target number of pages.
> > + * Can be used to reserve some more room for caches and the like.
> > + */
> > +static unsigned int selfballoon_reserved_mb;
> > +
> > static void selfballoon_process(struct work_struct *work);
> > static DECLARE_DELAYED_WORK(selfballoon_worker, selfballoon_process);
> >
> > @@ -217,7 +223,8 @@ static void selfballoon_process(struct work_struct *work)
> > cur_pages = totalram_pages;
> > tgt_pages = cur_pages; /* default is no change */
> > goal_pages = percpu_counter_read_positive(&vm_committed_as) +
> > - totalreserve_pages;
> > + totalreserve_pages +
> > + MB2PAGES(selfballoon_reserved_mb);
> > #ifdef CONFIG_FRONTSWAP
> > /* allow space for frontswap pages to be repatriated */
> > if (frontswap_selfshrinking && frontswap_enabled)
> > @@ -397,6 +404,30 @@ static DEVICE_ATTR(selfballoon_min_usable_mb, S_IRUGO | S_IWUSR,
> > show_selfballoon_min_usable_mb,
> > store_selfballoon_min_usable_mb);
> >
> > +SELFBALLOON_SHOW(selfballoon_reserved_mb, "%d\n",
> > + selfballoon_reserved_mb);
> > +
> > +static ssize_t store_selfballoon_reserved_mb(struct device *dev,
> > + struct device_attribute *attr,
> > + const char *buf,
> > + size_t count)
> > +{
> > + unsigned long val;
> > + int err;
> > +
> > + if (!capable(CAP_SYS_ADMIN))
> > + return -EPERM;
> > + err = strict_strtoul(buf, 10, &val);
> > + if (err)
> > + return -EINVAL;
> > + selfballoon_reserved_mb = val;
> > + return count;
> > +}
> > +
> > +static DEVICE_ATTR(selfballoon_reserved_mb, S_IRUGO | S_IWUSR,
> > + show_selfballoon_reserved_mb,
> > + store_selfballoon_reserved_mb);
> > +
> >
> > #ifdef CONFIG_FRONTSWAP
> > SELFBALLOON_SHOW(frontswap_selfshrinking, "%d\n", frontswap_selfshrinking);
> > @@ -480,6 +511,7 @@ static struct attribute *selfballoon_attrs[] = {
> > &dev_attr_selfballoon_downhysteresis.attr,
> > &dev_attr_selfballoon_uphysteresis.attr,
> > &dev_attr_selfballoon_min_usable_mb.attr,
> > + &dev_attr_selfballoon_reserved_mb.attr,
> > #ifdef CONFIG_FRONTSWAP
> > &dev_attr_frontswap_selfshrinking.attr,
> > &dev_attr_frontswap_hysteresis.attr,
> >
> >
>
> _______________________________________________
> Xen-devel mailing list
> Xen-devel@lists.xen.org
> http://lists.xen.org/xen-devel
prev parent reply other threads:[~2012-05-10 14:42 UTC|newest]
Thread overview: 5+ messages / expand[flat|nested] mbox.gz Atom feed top
2012-04-29 19:34 Self-ballooning question / cache issue Jana Saout
2012-05-01 16:52 ` Dan Magenheimer
2012-05-02 10:13 ` Jana Saout
2012-05-02 17:51 ` Dan Magenheimer
2012-05-10 14:42 ` Konrad Rzeszutek Wilk [this message]
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=20120510144237.GI26152@phenom.dumpdata.com \
--to=konrad.wilk@oracle.com \
--cc=dan.magenheimer@oracle.com \
--cc=jana@saout.de \
--cc=xen-devel@lists.xensource.com \
/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).