vmem to pmem

60 views
Skip to first unread message

Krishna Harathi

unread,
Feb 18, 2017, 3:56:36 PM2/18/17
to pmem
Is there a way to "promote" a vmem block of memory to a pmem block?

Use case - to land a network IO input buffer directly in a vmem buffer. When the receiver service ack's the input, convert the vmem to pmem. Un-acknowledged vmem buffers will be naturally scratched on a restart.

Thanks for any insight into this.
                  

Andy Rudoff

unread,
Feb 18, 2017, 7:04:00 PM2/18/17
to pmem
Hi Krishna,

Seems like this use case should just use pmem.  Start a transaction, allocate the buffer, receive into it, and when it is acknowledged, commit the transaction.  Anything uncommitted will go back to the free list on restart because that's how transactions work.

The memory used with the vmem library is "nameless" -- there's no way to re-attached to it later (because the intention is volatile memory).  So converting from vmem to pmem would have to start by copying the data to a range of pmem so programs can open it again by name.  So I think you're better off going for the zero-copy method I mentioned above.

-andy

Piotr Balcer

unread,
Feb 21, 2017, 4:49:45 AM2/21/17
to pmem

Hi,
To build on what Andy said, we've been also working on a design for a feature
that seems to match your exact use case:
https://github.com/pmem/issues/issues/415

When implemented, this will allow you to perform a fast volatile allocation,
which we call reservation (because in truth, it only reserves the pmem storage,
and doesn't modify any related state), hold it for any arbitrary amount of time,
and once ready, publish it. The planned API will also allow you to cancel any
reservations, so that if other resources become unavailable, you are not stuck
with not needed memory.

If you have any suggestions, feel free to leave a comment on the issue I linked.

Piotrek

Krishna Harathi

unread,
Mar 6, 2017, 9:19:29 PM3/6/17
to pmem
A belated thanks for pointing me in this direction We will check it out asap.
Reply all
Reply to author
Forward
0 new messages