pmem2_vm_reservation_extend - Man Page

extends and shrinks existing virtual memory reservation

Synopsis

#include <libpmem2.h>

struct pmem2_vm_reservation;
int pmem2_vm_reservation_extend(struct pmem2_vm_reservation *rsv, size_t size);
int pmem2_vm_reservation_shrink(struct pmem2_vm_reservation *rsv, size_t offset,
        size_t size);

Description

The pmem2_vm_reservation_extend() function extends an existing virtual memory reservation by the given size. For the function to succeed the size has to be aligned to an appropriate allocation granularity.

If the pmem2_vm_reservation_extend() succeeds in extending a reservation, it provides placeholder virtual memory range that starts from an address at the end of the old reservation. Mappings made to the reservation before extending are preserved.

The pmem2_vm_reservation_shrink() function shrinks the reservation by a region specified by offset into the reservation and the size. For the function to succeed the size and offset variables have to be aligned to an appropriate allocation granularity. The region formed by offset and size has to belong to the reservation, be empty and it needs to cover the beginning or the end of the reservation. Shrinking reservation from the middle or shrinking the whole reservation is not supported.

If the pmem2_vm_reservation_shrink() succeeds in shrinking a reservation, it releases placeholder virtual memory range that was designated by offset and size variables. Mappings made to the reservation before shrinking are preserved.

If either of those functions fails, reservation will be left as it was and appropriate error value will be returned.

Return Value

The pmem2_vm_reservation_extend() and pmem2_vm_reservation_shrink() functions return 0 on success or a negative error code on failure.

Errors

The pmem2_vm_reservation_extend() function can fail with the following errors:

It can also return -EAGAIN, -ENOMEM from the underlying mmap(2) function.

The pmem2_vm_reservation_shrink() function can fail with the following errors:

It can also return -EAGAIN and -ENOMEM from the underlying munmap(2) function.

See Also

pmem2_vm_reservation_new(3), pmem2_config_set_vm_reservation(3), libpmem2(7) and <https://pmem.io>

Referenced By

The man page pmem2_vm_reservation_shrink(3) is an alias of pmem2_vm_reservation_extend(3).

2024-01-25 PMDK - PMDK Programmer's Manual