1*e13b1fa5SApple OSS Distributions<h2>vm_behavior_set</h2> 2*e13b1fa5SApple OSS Distributions<hr> 3*e13b1fa5SApple OSS Distributions<p> 4*e13b1fa5SApple OSS Distributions<strong>Function</strong> - Specify expected access patterns for the target VM region. 5*e13b1fa5SApple OSS Distributions<h3>SYNOPSIS</h3> 6*e13b1fa5SApple OSS Distributions<pre> 7*e13b1fa5SApple OSS Distributions<strong>kern_return_t vm_behavior_set</strong> 8*e13b1fa5SApple OSS Distributions <strong>(vm_task_t</strong> <var>target_task</var>, 9*e13b1fa5SApple OSS Distributions <strong>vm_address_t</strong> <var>address</var>, 10*e13b1fa5SApple OSS Distributions <strong>vm_size_t</strong> <var>size</var>, 11*e13b1fa5SApple OSS Distributions <strong>vm_behavior_t</strong> <var>behavior</var><strong>);</strong> 12*e13b1fa5SApple OSS Distributions</pre> 13*e13b1fa5SApple OSS Distributions<h3>PARAMETERS</h3> 14*e13b1fa5SApple OSS Distributions<dl> 15*e13b1fa5SApple OSS Distributions<p> 16*e13b1fa5SApple OSS Distributions<dt> <var>target_task</var> 17*e13b1fa5SApple OSS Distributions<dd> 18*e13b1fa5SApple OSS Distributions[in task send right] 19*e13b1fa5SApple OSS DistributionsThe port for the task in whose address space the 20*e13b1fa5SApple OSS Distributionsmemory object behavior is to be set. 21*e13b1fa5SApple OSS Distributions<p> 22*e13b1fa5SApple OSS Distributions<dt> <var>address</var> 23*e13b1fa5SApple OSS Distributions<dd> 24*e13b1fa5SApple OSS Distributions[in scalar] 25*e13b1fa5SApple OSS DistributionsThe starting address for the memory region. 26*e13b1fa5SApple OSS Distributions<p> 27*e13b1fa5SApple OSS Distributions<dt> <var>size</var> 28*e13b1fa5SApple OSS Distributions<dd> 29*e13b1fa5SApple OSS Distributions[in scalar] 30*e13b1fa5SApple OSS DistributionsThe number of bytes in the region. 31*e13b1fa5SApple OSS Distributions<p> 32*e13b1fa5SApple OSS Distributions<dt> <var>behavior</var> 33*e13b1fa5SApple OSS Distributions<dd> 34*e13b1fa5SApple OSS Distributions[in scalar] 35*e13b1fa5SApple OSS DistributionsThe expected reference pattern for the memory. Possible 36*e13b1fa5SApple OSS Distributionsvalues are: 37*e13b1fa5SApple OSS Distributions<dl> 38*e13b1fa5SApple OSS Distributions<p> 39*e13b1fa5SApple OSS Distributions<dt> <strong>VM_BEHAVIOR_DEFAULT</strong> 40*e13b1fa5SApple OSS Distributions<dd> 41*e13b1fa5SApple OSS DistributionsThe system's default behavior. Assumes strong locality of 42*e13b1fa5SApple OSS Distributionsreference, so LRU page replacement, possibly with pre-fetch, 43*e13b1fa5SApple OSS Distributionswould be appropriate. 44*e13b1fa5SApple OSS Distributions<p> 45*e13b1fa5SApple OSS Distributions<dt> <strong>VM_BEHAVIOR_RANDOM</strong> 46*e13b1fa5SApple OSS Distributions<dd> 47*e13b1fa5SApple OSS DistributionsNo particular order expected. Assumes weak locality of 48*e13b1fa5SApple OSS Distributionsreference, so LRU page replacement may be ineffective. 49*e13b1fa5SApple OSS Distributions<p> 50*e13b1fa5SApple OSS Distributions<dt> <strong>VM_BEHAVIOR_SEQUENTIAL</strong> 51*e13b1fa5SApple OSS Distributions<dd> 52*e13b1fa5SApple OSS DistributionsForward sequential order. 53*e13b1fa5SApple OSS Distributions<p> 54*e13b1fa5SApple OSS Distributions<dt> <strong>VM_BEHAVIOR_RSEQNTL</strong> 55*e13b1fa5SApple OSS Distributions<dd> 56*e13b1fa5SApple OSS DistributionsReverse sequential order. 57*e13b1fa5SApple OSS Distributions</dl> 58*e13b1fa5SApple OSS Distributions</dl> 59*e13b1fa5SApple OSS Distributions<h3>DESCRIPTION</h3> 60*e13b1fa5SApple OSS Distributions<p> 61*e13b1fa5SApple OSS DistributionsThe <strong>vm_behavior_set</strong> function informs the kernel of 62*e13b1fa5SApple OSS Distributionsthe expected access 63*e13b1fa5SApple OSS Distributionspattern for a region of memory. The kernel uses this information 64*e13b1fa5SApple OSS Distributionsto bias its prefetch and page 65*e13b1fa5SApple OSS Distributionsreplacement algorithms. 66*e13b1fa5SApple OSS Distributions<p> 67*e13b1fa5SApple OSS DistributionsThe region starts at the beginning of the virtual page containing 68*e13b1fa5SApple OSS Distributions<var>address</var>; it ends at the end of the virtual page containing 69*e13b1fa5SApple OSS Distributions<var>address</var> + <var>size</var> - 1. Because of this 70*e13b1fa5SApple OSS Distributionsrounding to virtual page boundaries, the amount of memory affected may be 71*e13b1fa5SApple OSS Distributionsgreater than <var>size</var>. Use <strong>host_page_size</strong> 72*e13b1fa5SApple OSS Distributionsto find the current virtual page size. 73*e13b1fa5SApple OSS Distributions<h3>NOTES</h3> 74*e13b1fa5SApple OSS Distributions<p> 75*e13b1fa5SApple OSS DistributionsThis interface is machine word length specific because of the virtual address 76*e13b1fa5SApple OSS Distributionsparameter. 77*e13b1fa5SApple OSS Distributions<h3>RETURN VALUES</h3> 78*e13b1fa5SApple OSS Distributions<dl> 79*e13b1fa5SApple OSS Distributions<p> 80*e13b1fa5SApple OSS Distributions<dt> <strong>KERN_INVALID_ADDRESS</strong> 81*e13b1fa5SApple OSS Distributions<dd> 82*e13b1fa5SApple OSS DistributionsThe specified address is illegal or reserved. 83*e13b1fa5SApple OSS Distributions</dl> 84*e13b1fa5SApple OSS Distributions<h3>RELATED INFORMATION</h3> 85*e13b1fa5SApple OSS Distributions<p> 86*e13b1fa5SApple OSS DistributionsFunctions: 87*e13b1fa5SApple OSS Distributions<a href="vm_region.html"><strong>vm_region</strong></a>, 88*e13b1fa5SApple OSS Distributions<a href="host_page_size.html"><strong>host_page_size</strong></a>. 89