WARNING - OLD ARCHIVES

This is an archived copy of the Xen.org mailing list, which we have preserved to ensure that existing links to archives are not broken. The live archive, which contains the latest emails, can be found at http://lists.xen.org/
   
 
 
Xen 
 
Home Products Support Community News
 
   
 

xen-devel

Re: [Xen-devel] [RFC] Replacing Xen's xmalloc engine and(?) API

To: Dan Magenheimer <dan.magenheimer@xxxxxxxxxx>, "Xen-Devel (E-mail)" <xen-devel@xxxxxxxxxxxxxxxxxxx>
Subject: Re: [Xen-devel] [RFC] Replacing Xen's xmalloc engine and(?) API
From: Keir Fraser <keir.fraser@xxxxxxxxxxxxx>
Date: Sun, 12 Oct 2008 17:47:26 +0100
Cc: Diwaker Gupta <dgupta@xxxxxxxxxxx>, nitingupta910@xxxxxxxxx, kurt.hackel@xxxxxxxxxx
Delivery-date: Sun, 12 Oct 2008 09:47:38 -0700
Envelope-to: www-data@xxxxxxxxxxxxxxxxxxx
In-reply-to: <3b29ca35-2328-4fe3-a95c-fd16b0ce52bc@default>
List-help: <mailto:xen-devel-request@lists.xensource.com?subject=help>
List-id: Xen developer discussion <xen-devel.lists.xensource.com>
List-post: <mailto:xen-devel@lists.xensource.com>
List-subscribe: <http://lists.xensource.com/mailman/listinfo/xen-devel>, <mailto:xen-devel-request@lists.xensource.com?subject=subscribe>
List-unsubscribe: <http://lists.xensource.com/mailman/listinfo/xen-devel>, <mailto:xen-devel-request@lists.xensource.com?subject=unsubscribe>
Sender: xen-devel-bounces@xxxxxxxxxxxxxxxxxxx
Thread-index: AcksijTRc3P5+5h9Ed22twAWy6hiGQ==
Thread-topic: [Xen-devel] [RFC] Replacing Xen's xmalloc engine and(?) API
User-agent: Microsoft-Entourage/11.4.0.080122
On 12/10/08 17:28, "Dan Magenheimer" <dan.magenheimer@xxxxxxxxxx> wrote:

>> This sounds crazy to me. xmalloc() should work like malloc().
> 
> While I agree completely in principle, abstractions can be costly.
> In this case, the fact that xmalloc(PAGE_SIZE-1) actually uses
> 2*PAGE_SIZE of space (and fails even if there are lots of free
> pages but no pair of contiguous pages) is an undocumented consequence
> of the underlying implementation... which is not entirely
> unreasonable in user-land but is IMHO questionable in the guts
> of a hypervisor where memory shouldn't be accidentally wasted.
> 
> To date, Xen hasn't focused much on optimizing memory usage but
> I think that will change over the next year or two.

This wastage should be empirically measured by instrumentation and then
optimisations made where worthwhile. That is somewhat orthogonal to the
issue of what represents a sensible interface to xmalloc(), except to say
that I would generally prefer a more sophisticated and efficient mechanism
behind a simple interface, rather than punt complexity into callers (by
making the costs hidden by the simple interface excessive and hence
unusable; or by complicating the interface with weird constraints).

My point in bringing up SLUB is that I assume it's an allocator designed to
work reasonably well across a range of allocation-request-size
distributions, including those containing requests of size
x-pages-minus-a-bit. I'd rather have a more complicated allocator than a
more complicated xmalloc() interface.

 -- Keir



_______________________________________________
Xen-devel mailing list
Xen-devel@xxxxxxxxxxxxxxxxxxx
http://lists.xensource.com/xen-devel