From: Dan Magenheimer Subject: Re: Proposed new "memory capacity claim" hypercall/feature Date: Thu, 8 Nov 2012 10:38:22 -0800 (PST) Message-ID: <092d8bc5-1643-40e0-a893-3e7ad78fe672@default> References: <50939A1502000078000A5F61@nat28.tlf.novell.com> <7481128d-3f65-4cc3-ad96-1d4e9cd25094@default> <509791F902000078000A64D4@nat28.tlf.novell.com> <7563be37-62f1-472e-9aec-1d0c55fa7c29@default> <509B74B402000078000A7206@nat28.tlf.novell.com> Mime-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit Return-path: In-Reply-To: <509B74B402000078000A7206@nat28.tlf.novell.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: Jan Beulich Cc: TimDeegan , Olaf Hering , Keir Fraser , IanCampbell , Konrad Wilk , George Dunlap , Ian Jackson , George Shuklin , xen-devel@lists.xen.org, DarioFaggioli , Kurt Hackel , Zhigang Wang List-Id: xen-devel@lists.xenproject.org > From: Jan Beulich [mailto:JBeulich@suse.com] > Subject: RE: Proposed new "memory capacity claim" hypercall/feature > > >>> On 07.11.12 at 23:17, Dan Magenheimer wrote: > > It appears that the attempt to use 2MB and 1GB pages is done in > > the toolstack, and if the hypervisor rejects it, toolstack tries > > smaller pages. Thus, if physical memory is highly fragmented > > (few or no order>=9 allocations available), this will result > > in one hypercall per 4k page so a 256GB domain would require > > 64 million hypercalls. And, since AFAICT, there is no sane > > way to hold the heap_lock across even two hypercalls, speeding > > up the in-hypervisor allocation path, by itself, will not solve > > the TOCTOU race. > > No, even in the absence of large pages, the tool stack will do 8M > allocations, just without requesting them to be contiguous. Rats, you are right (as usual). My debug code was poorly placed and missed this important point. So ignore the huge-number-of-hypercalls point and I think we return to: What is an upper time bound for holding the heap_lock and, for an arbitrary-sized domain in an arbitrarily-fragmented system, can the page allocation code be made fast enough to fit within that bound? I am in agreement that if the page allocation code can be fast enough so that the heap_lock can be held, this is a better solution than "claim". I am just skeptical that, in the presence of those two "arbitraries", it is possible. So I will proceed with more measurements before prototyping the "claim" stuff. Dan