From: Dan Magenheimer <dan.magenheimer@oracle.com>
To: Keir Fraser <keir.fraser@eu.citrix.com>,
"Xen-Devel (E-mail)" <xen-devel@lists.xensource.com>
Cc: Diwaker Gupta <dgupta@cs.ucsd.edu>,
nitingupta910@gmail.com, kurt.hackel@oracle.com
Subject: RE: [RFC] Replacing Xen's xmalloc engine and(?) API
Date: Sun, 12 Oct 2008 10:31:39 -0700 (PDT) [thread overview]
Message-ID: <f8f630e6-00ca-4fae-9356-8481d65556e1@default> (raw)
In-Reply-To: <C517E8AE.1E193%keir.fraser@eu.citrix.com>
> >> 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).
Fair enough. I will mimic the xmalloc API then. However, I *would*
like to export (via #define in xmalloc.h or function call or something)
the definition of DELTA (e.g. the xmalloc space overhead) so my
caller-side code can avoid the wastage. I never want to accidentally
xmalloc two pages when heap-alloc'ing one page will do.
> 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.
I'm no slab/slub expert but I think the interface only works
well with fixed-size objects and when several of the fixed-size
objects can be crammed into a single page. I have a large set
of objects that are essentially random in size (but all less
than or equal to a page).
Dan
next prev parent reply other threads:[~2008-10-12 17:31 UTC|newest]
Thread overview: 12+ messages / expand[flat|nested] mbox.gz Atom feed top
2008-10-11 21:44 [RFC] Replacing Xen's xmalloc engine and(?) API Dan Magenheimer
2008-10-11 22:12 ` Stefan de Konink
2008-10-11 22:59 ` Dan Magenheimer
2008-10-12 9:16 ` Keir Fraser
2008-10-12 10:25 ` Keir Fraser
2008-10-12 16:28 ` Dan Magenheimer
2008-10-12 16:47 ` Keir Fraser
2008-10-12 17:31 ` Dan Magenheimer [this message]
2008-10-12 17:42 ` Keir Fraser
[not found] <4cefeab80810121044j44687af3s78574b41c7a9ab04@mail.gmail.com>
2008-10-12 17:55 ` Keir Fraser
2008-10-12 18:03 ` Dan Magenheimer
2008-10-12 18:34 ` Keir Fraser
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=f8f630e6-00ca-4fae-9356-8481d65556e1@default \
--to=dan.magenheimer@oracle.com \
--cc=dgupta@cs.ucsd.edu \
--cc=keir.fraser@eu.citrix.com \
--cc=kurt.hackel@oracle.com \
--cc=nitingupta910@gmail.com \
--cc=xen-devel@lists.xensource.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.