Back to Darwin Xnu

Vm Behavior Set

osfmk/man/vm_behavior_set.html

latest1.8 KB
Original Source

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.

Functions: vm_region, host_page_size.