MOVE\_PAGES(2) Linux Programmer's Manual MOVE\_PAGES(2)

# [NAME](#NAME)

move\_pages - Move individual pages of a process to another node

# [SYNOPSIS](#SYNOPSIS)

**#include &lt;numaif.h&gt;**

**long move\_pages(int pid, unsigned long count, void \** pages, const int * nodes, int * status, int flags);**

# [DESCRIPTION](#DESCRIPTION)

**move\_pages**() moves *count* pages to the *nodes.* The result of the move is reflected in *status.* The *flags* indicate constraints on the pages to be moved.

*pid* is the process id in which pages are to be moved. Sufficient rights must exist to move pages of another process. This means the moving process either has root priviledges, has SYS\_NICE administrative rights or the same owner. If pid is 0 then we move pages of the current process.

*count* is the number of pages to move. It defines the size of the three arrays *pages,* *nodes* and *status.*

*pages* is an array of pointers to the pages that should be moved. These are pointers that should be aligned to page boundaries. Addresses are specified as seen by the process specified by *pid.*

*nodes* is either an array of integers that specify the desired location for each page or it is NULL. Each integer is a node number. If NULL is specified then move\_pages will not move any pages but return the node of each page in the *status* array. Having the status of each page may be necessary to determine pages that need to be moved.

*status* is an array of integers that return the status of each page. The array only contains valid values if *move\_pages* did not return an error code.

*flags* specify what types of pages to move. **MPOL\_MF\_MOVE** means that only pages that are in exclusive use by the process are to be moved. **MPOL\_MF\_MOVE\_ALL** means that pages shared between multiple processes can also be moved. The process must have root priviledges or SYS\_NICE priviledges.

# [Page states in the status array](#Page_states_in_the_status_array)

**0..MAX\_NUMNODES**

Indicates that the location of the page is on this node.

[**-ENOENT**](#ENOENT)

The page is not present.

[**-EACCES**](#EACCES)

The page is mapped by multiple processes and can only be moved if *MPOL\_MF\_MOVE\_ALL* is specified.

[**-EBUSY**](#EBUSY)

The page is currently busy and cannot be moved. Try again later. This occurs if a page is undergoing I/O or another kernel subsystem is holding a reference to the page.

[**-EFAULT**](#EFAULT)

This is a zero page or the memory area is not mapped by the process.

[**-ENOMEM**](#ENOMEM)

Unable to allocate memory on target node.

[**-EIO**](#EIO)

Unable to write back a page. The page has to be written back in order to move ti since the page is dirty and the filesystem has not provide a migration function that would allow the move of dirty pages.

[**-EINVAL**](#EINVAL)

A dirty page cannot be moved. The filesystem does not provide a migration function and has no ability to write back pages.

# [RETURN VALUE](#RETURN_VALUE)

On success **move\_pages** returns zero.

# [ERRORS](#ERRORS)

[**-ENOENT**](#ENOENT~2)

No pages were found that require moving. All pages are either already on the target node, not present, had an invalid address or could not be moved because they were mapped by multiple processes.

[**-EINVAL**](#EINVAL~2)

Flags other than *MPOL\_MF\_MOVE* and *MPOL\_MF\_MOVE\_ALL* was specified or an attempt was made to migrate pages of a kernel thread.

[**-EPERM**](#EPERM)

*MPOL\_MF\_MOVE\_ALL* specified without sufficient privileges or an attempt to move a process belonging to another user.

[**-EACCESS**](#EACCESS)

On of the target nodes is not allowed by the current cpuset.

[**-ENODEV**](#ENODEV)

On of the target nodes is not online.

[**-ESRCH**](#ESRCH)

Process does not exist.

[**-E2BIG**](#E2BIG)

Too many pages to move.

[**-EFAULT**](#EFAULT~2)

Parameter array could not be accessed.

# [SEE ALSO](#SEE_ALSO)

[**numa\_maps**(5)](/man/os/numactl/numa_maps.5), [**migratepages**(8)](/man/os/numactl/migratepages.8), [**numa\_stat**(8)](/man/os/numactl/numa_stat.8), [**numa**(3)](/man/os/numactl/numa.3)

2006-10-31 Linux 2.6.18

---

Document: move_pages(2) from numactl 2.0.19-r5 (Chainguard OS)
Source: https://github.com/numactl/numactl
