XENMEM_claim_pages

This xenmem command allows a privileged guest to stake a memory claim for a domain, identical to XEN_DOMCTL_claim_memory, which is extended for NUMA-aware claims. XENMEM_claim_pages should not be used for new code and is deprecated. XEN_DOMCTL_claim_memory provides the same claims semantics.

See Hypervisor documentation > Memory Management > Memory Claims for details on the API semantics and implementation details of the claims infrastructure of the Xen buddy allocator backing this hypercall.

API example (libxc)

The following example demonstrates how a toolstack can claim memory before building the domain and then releasing the claim once the memory population is complete.

#include <xenctrl.h>
...
    /* Claim memory for the domain build. */
    int ret = xc_domain_claim_pages(xch, domid, nr_pages);

    /* Build the domain and allocate memory for it. */
    ...

    /* Release any remaining claim after populating the domain memory. */
    int ret = xc_domain_claim_pages(xch, domid, 0);