Skip to content

No alloc#132

Merged
avsm merged 8 commits into
mirage:masterfrom
hannesm:no-alloc
Mar 23, 2017
Merged

No alloc#132
avsm merged 8 commits into
mirage:masterfrom
hannesm:no-alloc

Conversation

@hannesm
Copy link
Copy Markdown
Member

@hannesm hannesm commented Feb 24, 2017

rebased #128 on master, and removed the allocation interface. see mirage/mirage-net-xen#17 for reasoning why page-aligned allocation is not needed.

the allocation strategy is modified (API is changed), this may also lead to different memory behaviour.

@hannesm
Copy link
Copy Markdown
Member Author

hannesm commented Feb 24, 2017

I'm happy to hear your opinions (@dsheets @avsm @djs55) [and/or performance analysis of dns-forward, which atm doesn't seem to build in a MirageOS3 universe] -- I'm happy to update the mirage-skeleton dns example

@hannesm
Copy link
Copy Markdown
Member Author

hannesm commented Mar 9, 2017

this is now lying around since two weeks, anyone had a chance to look at it, and would like to share their opinion? this is a blocker (/precondition) for other refactorings I've in preparation, such as not throwing exceptions.

@dsheets
Copy link
Copy Markdown
Member

dsheets commented Mar 10, 2017

LGTM

Comment thread lib/packet.ml Outdated

let marshal txbuf dns =
let marshal dns =
let txbuf = Cstruct.create 4096 in
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It's this Cstruct.create that could potentially cripple performance for a caller, since there is now choice but to allocate a page for every packet. Previously, the caller of the interface would control memory allocation and could reuse pages from a free pool if it was safe.

Why not just make txbuf an optional function that can be passed in, that does the allocation (defaulting to Cstruct.create)?

OCaml doesn't deal particularly well with rapid page allocation via Bigarrays, since there is also a C-level proxy object that (unnecessarily in our use case) reference counts the memory, so I'm reluctant to make ocaml-dns force memory allocation on the caller unless there's a really good reason.

@hannesm
Copy link
Copy Markdown
Member Author

hannesm commented Mar 14, 2017

@avsm I re-added a ?alloc:(unit -> Cstruct.t) argument to Packet.marshal. is this good to go now?

EDIT: adjusted the lwt and async layer, made tests build again, canceled 5 travis jobs. ready to merge imho

@avsm
Copy link
Copy Markdown
Member

avsm commented Mar 22, 2017

lgtm; @djs55 is having a review also and then will merge/release.

@djs55
Copy link
Copy Markdown
Member

djs55 commented Mar 22, 2017

LGTM also.

@avsm avsm merged commit a3b01a7 into mirage:master Mar 23, 2017
@hannesm hannesm deleted the no-alloc branch March 23, 2017 14:05
avsm pushed a commit to avsm/ocaml-dns that referenced this pull request Jun 23, 2017
async: add backlog argument to serve
RyanGibb pushed a commit to RyanGibb/ocaml-dns that referenced this pull request Sep 26, 2022
Include packages that needed CLOCK API updates.
RyanGibb pushed a commit to RyanGibb/ocaml-dns that referenced this pull request Sep 26, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants