 |
Index for Section 3 |
|
 |
Alphabetical listing for N |
|
 |
Bottom of page |
|
nmadvise(3)
NAME
nmadvise - Advise the system of the expected paging behavior of a process
(libnuma).
SYNOPSIS
#include <numa.h>
#include <sys/nman.h>
int nmadvise(
void *addr,
long len,
int behav,
memalloc_attr_t *attr );
PARAMETERS
The parameters to the nmadvise() function are the same as for madvise(),
with the addition of the attr parameter:
addr
Points to the starting address of one memory region, or a list of
starting addresses and lengths for multiple regions, to which the
advice refers.
len If a positive value, specifies the length, in bytes, of one region
starting at the address specified by the addr parameter.
If a negative value, specifies that the addr parameter points to an
array of regions (an array of starting addresses and their lengths). In
this case, -len indicates the number of regions in the array. See the
description of the nmemalloc_range_t type in numa_types(4) for more
information about the type used for array elements.
behav
Specifies the behavior of the region. See DESCRIPTION for details.
attr
Points to a structure containing the memory allocation policy and
attributes that will be assigned to the region or regions specified by
the addr and len parameters.
DESCRIPTION
The nmadvise() function permits a process to advise the system about its
expected future behavior in referencing a mapped file or shared memory
region. The nmadvise() function supports the following flags for the behav
parameter, in addition to those documented in madvise(2):
MADV_CURRENT
Prepare the specified range or object for migration to the memory
regions specified by the memory allocation policy attributes.
Without this flag, only new allocations occur from the regions
specified by the new allocation policy attributes.
MADV_WAIT
This flag may be logically ORed with the MADV_CURRENT flag to
indicate that the application should wait for migration to occur.
Without this flag, the nmadvise() function may return before all of
the pages in the range have been migrated or replicated, subject to
resource availability. If the requested resources are not
available, the function will terminate when the resources are
exhausted. See MADV_INSIST.
MADV_INSIST
When used in conjunction with MADV_WAIT, when the requested
resource is exhausted, the remaining memory will be paged out to
the backing store.
If, in the structure pointed to by attr, the mattr_policy member is
MPOL_DIRECTED and the mattr_rad member is RAD_NONE, the mattr_radset member
specifies the set of Resource Affinity Domains (RADs) where the pages of
the specified range will be allocated.
If the mattr_radset member is NULL, the system will select a RAD for the
memory object from among all of the RADs in the caller's partition. In this
case, the overflow set will be NULL.
If the attr parameter is NULL, any behav flags specific to nmadvise()are
ignored, and the function is equivalent to madvise().
NOTES
As with madvise(), the behaviors specified with nmadvise() are considered
by the system to be hints, and may in fact, be unimplemented. Unimplemented
behaviors will always return success.
RETURN VALUES
0 Success.
-1 Failure. In this case, errno is set to indicate the error.
ERRORS
If the nmadvise() function fails, it sets errno is set to one of the
following values for the reason specified:
[EFAULT]
A non-NULL attr argument points to an invalid address.
[EINVAL]
The behav parameter is invalid.
[EINVAL]
The structure pointed to by the attr argument contains an invalid
memory allocation policy, an invalid RAD, or an invalid RAD set.
[ENOSPC]
The behav parameter specifies MADV_SPACEAVAIL, and resources cannot be
reserved.
SEE ALSO
Functions: madvise(2), nmmap(3), numa_intro(3)
Files: numa_types(4)
 |
Index for Section 3 |
|
 |
Alphabetical listing for N |
|
 |
Top of page |
|