vm_behavior_set


Function - Specify expected access patterns for the target VM region.

SYNOPSIS

kern_return_t   vm_behavior_set
                (vm_task_t                          target_task,
                 vm_address_t                           address,
                 vm_size_t                                 size,
                 vm_behavior_t                         behavior);

PARAMETERS

target_task
[in task send right] The port for the task in whose address space the memory object behavior is to be set.

address
[in scalar] The starting address for the memory region.

size
[in scalar] The number of bytes in the region.

behavior
[in scalar] The expected reference pattern for the memory. Possible values are:

VM_BEHAVIOR_DEFAULT
The system's default behavior. Assumes strong locality of reference, so LRU page replacement, possibly with pre-fetch, would be appropriate.

VM_BEHAVIOR_RANDOM
No particular order expected. Assumes weak locality of reference, so LRU page replacement may be ineffective.

VM_BEHAVIOR_SEQUENTIAL
Forward sequential order.

VM_BEHAVIOR_RSEQNTL
Reverse sequential order.

DESCRIPTION

The vm_behavior_set function informs the kernel of the expected access pattern for a region of memory. The kernel uses this information to bias its prefetch and page replacement algorithms.

The region starts at the beginning of the virtual page containing address; it ends at the end of the virtual page containing address + size - 1. Because of this rounding to virtual page boundaries, the amount of memory affected may be greater than size. Use host_page_size to find the current virtual page size.

NOTES

This interface is machine word length specific because of the virtual address parameter.

RETURN VALUES

KERN_INVALID_ADDRESS
The specified address is illegal or reserved.

RELATED INFORMATION

Functions: vm_region, host_page_size.