Scroll to navigation

UFFDIO_SET_MODE(2const) UFFDIO_SET_MODE(2const)

NAME

UFFDIO_SET_MODE - toggle userfaultfd runtime mode bits

LIBRARY

Standard C library (libc-lc)

SYNOPSIS

#include <linux/userfaultfd.h>  /* Definition of UFFD* constants */
#include <sys/ioctl.h>
int ioctl(int fd, UFFDIO_SET_MODE, struct uffdio_set_mode *argp);
#include <linux/userfaultfd.h>

struct uffdio_set_mode {
    __u64  enable;   /* Feature bits to set */
    __u64  disable;  /* Feature bits to clear */
};

DESCRIPTION

Toggle userfaultfd features that may be flipped at runtime.

Bits set in .enable turn the named features on; bits set in .disable turn them off. The two fields must not overlap. Today only UFFD_FEATURE_RWP_ASYNC is a valid bit in either field; any other bit causes the ioctl to fail with EINVAL. Enabling UFFD_FEATURE_RWP_ASYNC also requires UFFD_FEATURE_RWP to have been negotiated at UFFDIO_API(2const) time.

The operation is serialized against in-flight page faults, so the new mode takes effect only after every fault that started before the call has finished, and any fault that starts after the call observes the new mode. This allows a single userfaultfd to switch between lightweight async detection and synchronous eviction without re-registering its ranges.

RETURN VALUE

On success, 0 is returned. On error, -1 is returned and errno is set to indicate the error.

ERRORS

A bit other than UFFD_FEATURE_RWP_ASYNC was specified in .enable or .disable.
The fields .enable and .disable overlap.
UFFD_FEATURE_RWP_ASYNC was requested without UFFD_FEATURE_RWP having been negotiated.
argp refers to an address that is outside the calling process's accessible address space.

STANDARDS

Linux.

HISTORY

Linux 7.2.

EXAMPLES

See userfaultfd(2).

SEE ALSO

ioctl(2), ioctl_userfaultfd(2), userfaultfd(2)

linux.git/Documentation/admin-guide/mm/userfaultfd.rst

2026-05-28 Linux man-pages 6.19