From mboxrd@z Thu Jan 1 00:00:00 1970 From: David Vrabel Subject: Re: [PATCH] x86: use 'dom0_mem' to limit the number of pages for dom0 Date: Tue, 23 Aug 2011 16:54:16 +0100 Message-ID: <4E53CD28.8040207@citrix.com> References: <1ec6c392d40f37032b0c.1313431713@qabil> <4E5388A30200007800052B77@nat28.tlf.novell.com> Mime-Version: 1.0 Content-Type: text/plain; charset="ISO-8859-1" Content-Transfer-Encoding: 7bit Return-path: In-Reply-To: <4E5388A30200007800052B77@nat28.tlf.novell.com> List-Unsubscribe: , List-Post: List-Help: List-Subscribe: , Sender: xen-devel-bounces@lists.xensource.com Errors-To: xen-devel-bounces@lists.xensource.com To: Jan Beulich Cc: "xen-devel@lists.xensource.com" , Keir Fraser List-Id: xen-devel@lists.xenproject.org On 23/08/11 10:01, Jan Beulich wrote: >>>> On 15.08.11 at 20:08, David Vrabel wrote: >> x86: use 'dom0_mem' to limit the number of pages for dom0 >> >> Use the 'dom0_mem' command line option to set the maximum number of >> pages for dom0. dom0 can use then use the XENMEM_maximum_reservation >> memory op to automatically find this limit and reduce the size of any >> page tables etc. >> >> Signed-off-by: David Vrabel >> >> diff -r 8d6edc3d26d2 -r 1ec6c392d40f xen/arch/x86/domain_build.c >> --- a/xen/arch/x86/domain_build.c Sat Aug 13 10:14:58 2011 +0100 >> +++ b/xen/arch/x86/domain_build.c Mon Aug 15 11:42:37 2011 +0100 >> @@ -254,6 +254,8 @@ static unsigned long __init compute_dom0 >> } >> #endif >> >> + d->max_pages = min(max_pages, avail); > > Only having noticed this hypervisor side change in the patch set as it > now got applied to -unstable already, I have to object to this: It is > not memory hotplug compatible (i.e. Dom0, at least with a non-pvops > kernel, could have got ballooned up past the original limit once memory > got added to the system, whereas now you limit it to what was there > at boot time). If anything, this should be set to just max_pages, not > considering the amount of available memory at all. > > Besides that the assignment needs to be saturating, as struct domain's > max_pages member is only "unsigned int", whereas the local variables > are all "unsigned long". So in the end this should really be an equivalent > of > > d->max_pages = min(max_pages, UINT_MAX); Yeah, this makes sense. I'll send another patch tomorrow. David