All of lore.kernel.org
 help / color / mirror / Atom feed
From: Ian Campbell <ian.campbell@citrix.com>
To: Mike Latimer <mlatimer@suse.com>
Cc: ian.jackson@eu.citrix.com,
	Stefano Stabellini <stefano.stabellini@eu.citrix.com>,
	wei.liu2@citrix.com, xen-devel@lists.xen.org
Subject: Re: freemem-slack and large memory environments
Date: Fri, 27 Feb 2015 10:17:40 +0000	[thread overview]
Message-ID: <1425032260.14641.141.camel@citrix.com> (raw)
In-Reply-To: <3240823.yXxKDP4SRd@mlatimer1.dnsdhcp.provo.novell.com>

On Thu, 2015-02-26 at 13:38 -0700, Mike Latimer wrote:
> (Sorry for the delayed response, dealing with ENOTIME.)
> 
> On Thursday, February 26, 2015 05:47:21 PM Ian Campbell wrote:
> > On Thu, 2015-02-26 at 10:38 -0700, Mike Latimer wrote:
> >
> > >    rc = libxl_set_memory_target(ctx, 0, free_memkb - need_memkb, 1, 0);
> >
> > I think so. In essence we just need to update need_memkb on each
> > iteration, right?
> 
> Not quite...

Indeed, looking again I see that the 1 there means "relative", so I'm
still confused about why free_memkb - need_memkb isn't the correct delta
on every iteration.

Is the issue that if you have a current target of, say, 15 and you wish
to go to ten you would say

	libxl_set_memory_target(, 15 - (-5), 1, 0)
i.e.
	libxl_set_memory_target(, -5, 1, 0)

then the target would be set to 10, but if during
libxl_wait_for_free_memory you only ballooned -2 and failed the target
gets left at 10 but the current free is actually now 13 so next time
around you say:

	libxl_set_memory_target(, 13 - (-3), 1, 0)
i.e.
	libxl_set_memory_target(, -3, 1, 0)

and the target now becomes 10-3 == 7, rather than 13-3=10 as one might
expect?

>   need_memkb is used in the loop to determine if we have enough 
> free memory for the new domain. So, need_memkb should always remain set to the 
> total amount of memory requested - not just the amount of change still 
> required.
> 
> The easiest thing to do is set the dom0's memory target before the loop, which 
> is what my original patch did.

It seems like there are two viable approaches here:

First is to just set the target before the loop and wait (perhaps much
longer) for it to be achieved.

The second is to decrement the target in smaller steps and wait to reach
it each time.

I don't think an approach which sets a target, waits for that target to
be achieved and then on partial success tries to figure out what the
relative progress is and what is left to achieve  and factor that into a
new target request makes sense.

This is all confounded by the fact that the libxl_wait_for_free_*
functions have a barking interface. I've just seen this comment right
above:

/*
 * WARNING
 * This memory management API is unstable even in Xen 4.2.
 * It has a numer of deficiencies and we intend to replace it.
 *
 * The semantics of these functions should not be relied on to be very
 * coherent or stable.  We will however endeavour to keep working
 * existing programs which use them in roughly the same way as libxl.
 */

Given that I think that we should feel free, if necessary, to deprecate
the current interface and replace it with one which is actually usable.
Whatever that might mean.

Ian.

  reply	other threads:[~2015-02-27 10:17 UTC|newest]

Thread overview: 41+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2015-02-10  1:27 freemem-slack and large memory environments Mike Latimer
2015-02-10 21:34 ` Mike Latimer
2015-02-13 11:13   ` Wei Liu
2015-02-13 23:16     ` Mike Latimer
2015-02-18 14:10   ` Ian Campbell
2015-02-24 16:06     ` Stefano Stabellini
2015-02-24 16:54       ` Ian Campbell
2015-02-25 11:39         ` Stefano Stabellini
2015-02-25 12:00           ` Ian Campbell
2015-02-25 14:03             ` Ian Campbell
2015-02-25 14:09               ` Stefano Stabellini
2015-02-26 15:36                 ` Mike Latimer
2015-02-26 15:57                   ` Ian Campbell
2015-02-26 17:38                     ` Mike Latimer
2015-02-26 17:47                       ` Ian Campbell
2015-02-26 20:38                         ` Mike Latimer
2015-02-27 10:17                           ` Ian Campbell [this message]
2015-02-27 11:05                             ` Stefano Stabellini
2015-02-26 17:53                       ` Stefano Stabellini
2015-02-26 20:45                         ` Mike Latimer
2015-02-26 23:30                           ` Mike Latimer
2015-02-27 10:21                             ` Ian Campbell
2015-02-27 10:52                             ` Stefano Stabellini
2015-02-27 15:28                               ` Mike Latimer
2015-02-27 18:29                                 ` Mike Latimer
2015-02-28  0:31                                   ` Mike Latimer
2015-03-02 10:12                                     ` Stefano Stabellini
2015-03-02 10:44                                       ` Jan Beulich
2015-03-02 12:13                                         ` Stefano Stabellini
2015-03-02 13:04                                           ` Jan Beulich
     [not found]                                           ` <54F46DDB020000780006505B@suse.com>
2015-03-02 22:49                                             ` Mike Latimer
2015-03-02 11:42                                     ` Ian Campbell
2015-03-02 15:19                                       ` Stefano Stabellini
2015-03-02 16:04                                         ` Ian Campbell
2015-03-02 16:15                                           ` Stefano Stabellini
2015-03-02 22:49                                             ` Mike Latimer
2015-03-03 10:02                                               ` Ian Campbell
2015-03-03 10:32                                                 ` Stefano Stabellini
2015-03-03 10:40                                               ` Stefano Stabellini
2015-02-27  8:24                         ` Jan Beulich
2015-02-27 10:52                           ` Stefano Stabellini

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=1425032260.14641.141.camel@citrix.com \
    --to=ian.campbell@citrix.com \
    --cc=ian.jackson@eu.citrix.com \
    --cc=mlatimer@suse.com \
    --cc=stefano.stabellini@eu.citrix.com \
    --cc=wei.liu2@citrix.com \
    --cc=xen-devel@lists.xen.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.