Replacing Xen's xmalloc engine and(?) API
A message that is not in the archive (sent off-list or not yet received): [email protected]
Quoted 7 lines · Nitin Gupta
Quoted 6 lines
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).
Quoted 7 lines
Using slab for your use case, which requires lot of allocations for near page-sized objects, is really bad idea. For memory compression project (compcache) I had very similar requirement. So, I tested kmalloc which uses slabs of various sizes to allocate various sizes. As expected its space efficiency was horrible. At least for compcache workload it used ~40% more memory than TLSF. Please refer:
http://code.google.com/p/compcache/wiki/AllocatorsComparison
Yes, I was just going to reply to Dan's TLSF email to say that my default plan for improving xmalloc() was going to be to implement a sub-page buddy allocator or to port SLUB from Linux. Noth of these place metadata in the page-info structure, but both would end up allocating power-of-two-sized data blocks for random allocations of xmalloc(). The overheads of this -- for example if many allocations are just over 2048 bytes for example -- could be pretty nasty. I think TLSF sounds quite an intriquing alternative.
-- Keir
Hi Nitin --
Excellent! Your xvMalloc looks even better! I'll read the code and try it (tomorrow).
Keir, is a "GNU Lesser GPL Version 3" license OK for Xen?
Thanks,
Dan
Quoted 38 lines
-----Original Message-----
From: Nitin Gupta [mailto:[email protected]]
Sent: Sunday, October 12, 2008 11:45 AM
To: Dan Magenheimer
Cc: Keir Fraser; Xen-Devel (E-mail); Diwaker Gupta; Kurt Hackel
Subject: Re: [Xen-devel] [RFC] Replacing Xen's xmalloc engine and(?) APIQuoted 7 lines · Dan Magenheimer
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).
Using slab for your use case, which requires lot of allocations for near page-sized objects, is really bad idea. For memory compression project (compcache) I had very similar requirement. So, I tested kmalloc which uses slabs of various sizes to allocate various sizes. As expected its space efficiency was horrible. At least for compcache workload it used ~40% more memory than TLSF. Please refer:
http://code.google.com/p/compcache/wiki/AllocatorsComparisonRegarding non-standard TLSF interface, it should be quite simple to have wrappers around TLSF to have standard malloc/free API.
Also I recently completed draft implementation of a new allocator - xvMalloc (based on TLSF) that is specifically suited for allocation behavior of compcache (I think "difference engine" project has almost same requirements).
http://code.google.com/p/compcache/wiki/xvMallocNitin
Quoted 4 lines · Dan Magenheimer
Excellent! Your xvMalloc looks even better! I'll read the code and try it (tomorrow).
Keir, is a "GNU Lesser GPL Version 3" license OK for Xen?
Unfortunately I doubt it, since Xen is GPLv2 and we wouldn't really be linking against xvMalloc as a separate library (not least because it would probably get tailored a bit to get checked into the Xen tree) so the 'Lesser' license probably doesn't apply. If Nitin isn't too attached to GPLv3 it would certainly be better for us if it used GPLv2, like TLSF.
-- Keir