Function pmem::persist
[−]
[src]
pub fn persist<T>(x: &T)
Force an object to be stored durably in persistent memory.
This is equivalent to calling msync(1)
but may be more optimal
and will avoid calling into the kernel if possible.
There are no alignment restrictions on the range the object is in,
but persist(1)
may expand the range as necessary to meet platform alignment requirements.
Warning: Like
msync()
, there is nothing atomic or transactional about this call. Any unwritten stores in the given range will be written, but some stores may have already been written by virtue of normal cache eviction/replacement policies. Correctly written code must not depend on stores waiting untilpersist(1)
is called to become persistent -- they can become persistent at any time beforepersist(1)
is called.
To create your own variations of persist(1)
, see flush(1)
and drain()
. One can think of persist(1)
as:
fn persist<T>(x: &T) { // flush the processor caches pmem::flush(x); // wait for any pmem stores to drain from HW buffers pmem::drain(); }