From: Daniel Kiper Subject: Re: Bug - Xen 4.3 - xl ignores maxmem setting in domU config file Date: Tue, 29 Oct 2013 19:02:06 +0100 Message-ID: <20131029180206.GC3425@debian70-amd64.local.net-space.pl> References: <20131029102600.GA23307@dingwall.me.uk> <20131029105921.GB5221@zion.uk.xensource.com> <526F9699.1070903@citrix.com> <20131029120804.GD5221@zion.uk.xensource.com> <20131029144935.GJ20487@phenom.dumpdata.com> Mime-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit Return-path: Content-Disposition: inline In-Reply-To: <20131029144935.GJ20487@phenom.dumpdata.com> List-Unsubscribe: , List-Post: List-Help: List-Subscribe: , Sender: xen-devel-bounces@lists.xen.org Errors-To: xen-devel-bounces@lists.xen.org To: Konrad Rzeszutek Wilk Cc: Wei Liu , ian.campbell@citrix.com, Stefano Stabellini , Andrew Cooper , James Dingwall , xen-devel@lists.xen.org, ian.jackson@eu.citrix.com List-Id: xen-devel@lists.xenproject.org On Tue, Oct 29, 2013 at 10:49:35AM -0400, Konrad Rzeszutek Wilk wrote: > On Tue, Oct 29, 2013 at 12:08:04PM +0000, Wei Liu wrote: > > On Tue, Oct 29, 2013 at 11:06:01AM +0000, Andrew Cooper wrote: > > > On 29/10/13 10:59, Wei Liu wrote: > > > > On Tue, Oct 29, 2013 at 10:26:00AM +0000, James Dingwall wrote: > > > >> Hi, > > > >> > > > >> I am having some memory ballooning problems which only seem to have > > > >> appeared since upgrading to Xen 4.3. In short if I set the domU > > > >> configuration file as: > > > >> > > > >> memory = 512 > > > >> maxmem = 1024 > > > >> > > > >> Then even under memory pressure the guest domain does not balloon past > > > >> the value of the 'memory' parameter. > > > >> > > > >> xl info shows plenty of available memory in dom0: > > > >> total_memory : 32767 > > > >> free_memory : 12445 > > > >> > > > >> > > > >> xl list -l on the domain shows: > > > >> "max_memkb": 1048576, > > > >> "target_memkb": 524288, > > > >> > > > > This is parsed from your config file so they should always look OK to > > > > you. > > > > > > > > Does the following patch help? > > > > > > > > Git blame tells me the change to set maxmem to target_memkb was > > > > introduced 4 years ago so I suspect there's reason to do that. If we > > > > cannot fix it here we need to insert the corresponding call later. > > > > > > When setmaxmem sets a limit lower than current, the domain can strictly > > > only balloon down until it is equal to or under the new limit. > > > > > > Performing a setmaxmem hypercall to info->target_memkb will prevent from > > > domain from ballooning down then back up a bit, when it has been asked > > > to balloon down a lot; i.e. it must strictly balloon down to the limit > > > it has been given. > > > > > > Therefore, I am not sure this change is valid. > > > > > > ~Andrew > > > > > > > Looking at the changeset 9905ac that introduced target_memkb, > > target_memkb was always set to max_memkb, so my guess is that the > > purpose was still to use max_memkb to be max memory limit. > > > > Probably later changes to that portion of code altered that behavior. > > > > The use of target_memkb in xc_domain_setmaxmem looks logically wrong to > > me anyway... > > > > Stefano, thoughts? > > Lets also include Daniel in this - as he was trying to fix this in the past. As I remember this behavior is by design. However, this is not in line with xm behavior which sometimes makes a problem. I have discussed this with IanJ and IanC (both CC-ed here) once. I have proposed some patch series to fix that issue but later I was not able to continue work on it. If you wish I could repost them once again with fixes requested by IanJ and IanC. You could also find latest version of patches here: http://lists.xenproject.org/archives/html/xen-devel/2013-04/msg03072.html Daniel