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