From: Tim Deegan Subject: Re: [PATCH 1/6] mmu: Introduce XENMEM_claim_pages (subop of memory ops). Date: Wed, 6 Mar 2013 09:07:46 +0000 Message-ID: <20130306090746.GA15637@ocelot.phlegethon.org> References: <1362419234-29446-1-git-send-email-konrad.wilk@oracle.com> <1362419234-29446-2-git-send-email-konrad.wilk@oracle.com> <20130305120156.GA1139@ocelot.phlegethon.org> <20130305214320.GB8235@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: <20130305214320.GB8235@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: dan.magenheimer@oracle.com, xen-devel@lists.xensource.com, keir@xen.org, keir.xen@gmail.com List-Id: xen-devel@lists.xenproject.org Hi, At 16:43 -0500 on 05 Mar (1362501800), Konrad Rzeszutek Wilk wrote: > > The 'normal' restriction isn't actually enforced except at claim time. > > Since the gate in alloc_heap_pages is effectively: > > The big thing is *might*. I put this in the code path to explain better: > > /* note; The usage of tmem claim means that allocation from a guest *might* > + * have to come from freeable memory. Using free memory is always better, if > + * it is available, than using freeable memory. This flag is for the use > + * case where the toolstack cannot be constantly aware of the exact current > + * value of free and/or freeable on each machine and is multi-machine > + * capable. It can try/fail a "normal" claim on all machines first then, > + * and if the normal claim on all machines fail, then "fallback" to a > + * tmem-flag type claim. Oh I see. That's pretty strange semantics for a 'claim', though. Wouldn't it make sense for the toolstack just to query free and claimed memory on the first pass and fail if there's not enough space? The race between that query and the claim call (i.e. enough actually-free space at query time but only freeable memory at claim time) isn't materially different from the claim succeeding and then tmem consuming the memory. And a race between multiple claims can be trivially avoided with a mutex in toolstack. > + * The memory claimed by a normal claim isn't enforced against "freeable > + * pages" once the claim is successful. That's by design. Once the claim > + * has been made, it still can take minutes before the claim is fully > + * satisfied. Tmem can make use of the unclaimed pages during this time > + * (to store ephemeral/freeable pages only, not persistent pages). > + */ > > Here is the updated patch (with the long git commit description removed). Thanks. Could you also replace the other uses of "unclaimed" (in interfaces & comments)? Cheers, Tim.