Linux and UNIX Man Pages

Linux & Unix Commands - Search Man Pages

madvise(2) [osf1 man page]

madvise(2)							System Calls Manual							madvise(2)

NAME
madvise - Advise the system of the expected paging behavior of a process SYNOPSIS
#include <sys/types.h> #include <sys/mman.h> int madvise ( caddr_t addr, size_t len, int behav ); PARAMETERS
Specifies the address of the region to which the advice refers. Specifies the length in bytes of the region specified by the addr parame- ter. Specifies the behavior of the region. The following values for the behav parameter are defined in the sys/mman.h header file: No further special treatment Expect random page references Expect sequential references Will need these pages Do not need these pages The system will free any whole pages in the specified region. All modifications will be lost and any swapped out pages will be dis- carded. Subsequent access to the region will result in a zero-fill-on-demand fault as though it is being accessed for the first time. Reserved swap space is not affected by this call. Ensure that resources are reserved DESCRIPTION
The madvise() function permits a process to advise the system about its expected future behavior in referencing a mapped file or shared memory region. NOTES
Only a few values of the behav parameter values are operational on Tru64 UNIX systems. Non-operational values cause the system to always return success (zero). RETURN VALUES
Upon successful completion, the madvise() function returns zero. Otherwise, -1 is returned and errno is set to indicate the error. ERRORS
If the madvise() function fails, errno may be set to one of the following values: The behav parameter is invalid. The behav parameter specifies MADV_SPACEAVAIL and resources cannot be reserved. RELATED INFORMATION
Functions: mmap(2) delim off madvise(2)

Check Out this Related Man Page

nmadvise(3)						     Library Functions Manual						       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: 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. 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. Specifies the behavior of the region. See DESCRIPTION for details. 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): 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. 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. 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 parti- tion. 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
Success. 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: A non-NULL attr argument points to an invalid address. The behav parameter is invalid. The structure pointed to by the attr argument contains an invalid memory allocation policy, an invalid RAD, or an invalid RAD set. 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) nmadvise(3)
Man Page