File: get_mempolicy.2

package info (click to toggle)
manpages 2.39-1
  • links: PTS
  • area: main
  • in suites: etch, etch-m68k
  • size: 9,712 kB
  • ctags: 7
  • sloc: sh: 361; perl: 162; makefile: 73; lisp: 22
file content (166 lines) | stat: -rw-r--r-- 4,533 bytes parent folder | download | duplicates (2)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
.\" Copyright 2003,2004 Andi Kleen, SuSE Labs.
.\"
.\" Permission is granted to make and distribute verbatim copies of this
.\" manual provided the copyright notice and this permission notice are
.\" preserved on all copies.
.\"
.\" Permission is granted to copy and distribute modified versions of this
.\" manual under the conditions for verbatim copying, provided that the
.\" entire resulting derived work is distributed under the terms of a
.\" permission notice identical to this one.
.\" 
.\" Since the Linux kernel and libraries are constantly changing, this
.\" manual page may be incorrect or out-of-date.  The author(s) assume no
.\" responsibility for errors or omissions, or for damages resulting from
.\" the use of the information contained herein.  
.\" 
.\" Formatted or processed versions of this manual, if unaccompanied by
.\" the source, must acknowledge the copyright and authors of this work.
.\" 
.\" 2006-02-03, mtk, substantial wording changes and other improvements
.\"
.TH GET_MEMPOLICY 2 "2006-02-07" "SuSE Labs" "Linux Programmer's Manual"
.SH SYNOPSIS
get_mempolicy \- Retrieve NUMA memory policy for a process
.SH NAME
.B "#include <numaif.h>" 
.nf
.sp
.BI "int get_mempolicy(int *" policy ", unsigned long *" nodemask , 
.BI "                  unsigned long " maxnode ", unsigned long " addr , 
.BI "                  unsigned long " flags );
.fi
.\" TBD rewrite this. it is confusing.
.SH DESCRIPTION
.BR get_mempolicy ()
retrieves the NUMA policy of the calling process or of a memory address,
depending on the setting of
.IR flags .

A NUMA machine has different
memory controllers with different distances to specific CPUs.
The memory policy defines in which node memory is allocated for 
the process.   

If
.IR flags
is specified as 0,
then information about the calling process's default policy 
(as set by
.BR set_mempolicy (2))
is returned.

If 
.I flags
specifies
.BR MPOL_F_ADDR ,
then information is returned about the policy governing the memory
address given in
.IR addr .
This policy may be different from the process's default policy if
.BR set_mempolicy (2)
has been used to establish a policy for the page containing
.IR addr .

If 
.I policy
is not NULL, then it is used to return the policy.
If 
.IR nodemask 
is not NULL, then it is used to return the nodemask associated 
with the policy.
.I maxnode 
is the maximum bit number plus one that can be stored into 
.IR nodemask .
The bit number is always rounded to a multiple of 
.IR "unsigned long" .
.\" 
.\" If
.\" .I flags 
.\" specifies both
.\" .B MPOL_F_NODE
.\" and 
.\" .BR MPOL_F_ADDR ,
.\" then 
.\" .I policy
.\" instead returns the number of the node on which the address
.\" .I addr
.\" is allocated.
.\" 
.\" If
.\" .I flags 
.\" specifies
.\" .B MPOL_F_NODE
.\" but not
.\" .BR MPOL_F_ADDR ,
.\" and the process's current policy is
.\" .BR MPOL_INTERLEAVE ,
.\" then 
.\" checkme: Andi's text below says that the info is returned in
.\" 'nodemask', not 'policy':
.\" .I policy
.\" instead returns the number of the next node that will be used for 
.\" interleaving allocation.
.\" FIXME .
.\" The other valid flag is 
.\" .I MPOL_F_NODE.
.\" It is only valid when the policy is 
.\" .I MPOL_INTERLEAVE.
.\" In this case not the interleave mask, but an unsigned long with the next
.\" node that would be used for interleaving is returned in 
.\" .I nodemask.
.\" Other flag values are reserved.

For an overview of the possible policies see
.BR set_mempolicy (2).
.SH RETURN VALUE
On success,
.BR get_mempolicy ()
returns 0;
on error, \-1 is returned and
.I errno 
is set to indicate the error.
.\" .SH ERRORS
.\" FIXME writeme -- no errors are listed on this page
.\" .
.\" .TP
.\" .B EINVAL
.\" .I nodemask 
.\" is non-NULL, and 
.\" .I maxnode
.\" is too small;
.\" or
.\" .I flags
.\" specified values other than
.\" .B MPOL_F_NODE
.\" or
.\" .BR MPOL_F_ADDR ;
.\" or
.\" .I flags
.\" specified
.\" .B MPOL_F_ADDR
.\" and
.\" .I addr
.\" is NULL.
.\" (And there are other EINVAL cases.)
.SH NOTES
This manual page is incomplete: 
it does not document the details the
.BR MPOL_F_NODE 
flag, 
which modifies the operation of 
.BR get_mempolicy ().
This is deliberate: this flag is not intended for application use, 
and its operation may change or it may be removed altogether in 
future kernel versions.  
.B Do not use it.
.SH "VERSIONS AND LIBRARY SUPPORT"
See
.BR mbind (2).
.SH CONFORMING TO
This system call is Linux specific.
.SH SEE ALSO
.BR mbind (2),
.BR set_mempolicy (2),
.BR numactl (8),
.BR numa (3)