From: Ian Jackson Subject: Re: [PATCH v2-resend 22/30] libxl: ocaml: event management [and 1 more messages] Date: Tue, 12 Nov 2013 16:41:37 +0000 Message-ID: <21122.23105.824704.593359@mariner.uk.xensource.com> References: <1383760205-20397-1-git-send-email-rob.hoes@citrix.com> <1383760205-20397-19-git-send-email-rob.hoes@citrix.com> <1377168678-25492-1-git-send-email-rob.hoes@citrix.com> <1377168678-25492-23-git-send-email-rob.hoes@citrix.com> <21020.59469.965364.832725@mariner.uk.xensource.com> <21120.60611.692531.460725@mariner.uk.xensource.com> <360717C0B01E6345BCBE64B758E22C2D16EB79@AMSPEX01CL03.citrite.net> <21122.16826.622192.625659@mariner.uk.xensource.com> <52824DF1.2030404@eu.citrix.com> Mime-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit Return-path: In-Reply-To: <52824DF1.2030404@eu.citrix.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: David Scott Cc: xen-devel@lists.xen.org, Rob Hoes , ian.campbell@citrix.com List-Id: xen-devel@lists.xenproject.org David Scott writes ("Re: [Xen-devel] [PATCH v2-resend 22/30] libxl: ocaml: event management [and 1 more messages]"): > Rob Hoes writes ("[Xen-devel] [PATCH v2-resend 22/30] libxl: ocaml: > event management"): > > This is quite striking. You're converting a bitfield into a linked > > list of consed enums. Does ocaml really not have something more > > resembling a set-of-small-enum type, represeted as a bitfield ? .. > Unfortunately there's no direct support for bitfields in OCaml's heap > data representation. The common pattern is to convert bitfields into > lists of constructors e.g. > > https://github.com/ocaml/ocaml/blob/trunk/otherlibs/unix/open.c#L74 How sad. > On the positive side, the GC is optimised specifically for the case of > short-lived small objects, since this is what you get when you write a > compiler or a theorem prover. An allocation in the minor heap is simply > a pointer bump, and the trash is chucked out pretty often. The rule of > thumb is that anything which has the allocation profile of a compiler or > a theorem prover usually works pretty well :-) OK :-). > I think if we're allocating a (shortish) list per "lump" of console I/O > we're probably ok since I assume we're allocating and deallocating > bigger buffers for the console data anyway. For higher throughput > channels (vchan, network, disk etc) I'd go for larger, > statically-allocated pools of buffers for the data and use a bigger > lump-size to amortize the cost of the metadata handling. libxl doesn't normally concern itself with the main data path, so vchan, network and disk i/o aren't a problem. So, I'm reassured on this point. The locking question is more difficult, I think. Ian.