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