OSDN Git Service

1f9ed3cba56a7955afbeb301878667d24278b697
[linuxjm/LDP_man-pages.git] / draft / man2 / get_mempolicy.2
1 .\" Copyright 2003,2004 Andi Kleen, SuSE Labs.
2 .\" and Copyright 2007 Lee Schermerhorn, Hewlett Packard
3 .\"
4 .\" Permission is granted to make and distribute verbatim copies of this
5 .\" manual provided the copyright notice and this permission notice are
6 .\" preserved on all copies.
7 .\"
8 .\" Permission is granted to copy and distribute modified versions of this
9 .\" manual under the conditions for verbatim copying, provided that the
10 .\" entire resulting derived work is distributed under the terms of a
11 .\" permission notice identical to this one.
12 .\"
13 .\" Since the Linux kernel and libraries are constantly changing, this
14 .\" manual page may be incorrect or out-of-date.  The author(s) assume no
15 .\" responsibility for errors or omissions, or for damages resulting from
16 .\" the use of the information contained herein.
17 .\"
18 .\" Formatted or processed versions of this manual, if unaccompanied by
19 .\" the source, must acknowledge the copyright and authors of this work.
20 .\"
21 .\" 2006-02-03, mtk, substantial wording changes and other improvements
22 .\" 2007-08-27, Lee Schermerhorn <Lee.Schermerhorn@hp.com>
23 .\"     more precise specification of behavior.
24 .\"
25 .\" Japanese Version Copyright (c) 2006 Akihiro MOTOKI
26 .\"         all rights reserved.
27 .\" Translated 2006-08-14, Akihiro MOTOKI <amotoki@dd.iij4u.or.jp>, LDP v2.39
28 .\" Updated 2008-02-13, Akihiro MOTOKI, LDP v2.77
29 .\" Updated 2008-08-06, Akihiro MOTOKI, LDP v3.05
30 .\" Updated 2008-08-21, Akihiro MOTOKI, LDP v3.07
31 .\" Updated 2008-11-19, Akihiro MOTOKI, LDP v3.13
32 .\"
33 .TH GET_MEMPOLICY 2 2008-08-15 Linux "Linux Programmer's Manual"
34 .\"O .SH NAME
35 .SH 名前
36 .\"O get_mempolicy \- Retrieve NUMA memory policy for a process
37 get_mempolicy \- プロセスの NUMA メモリのポリシーを取得する
38 .\"O .SH SYNOPSIS
39 .SH 書式
40 .nf
41 .B "#include <numaif.h>"
42 .sp
43 .BI "int get_mempolicy(int *" mode ", unsigned long *" nodemask ,
44 .BI "                  unsigned long " maxnode ", unsigned long " addr ,
45 .BI "                  unsigned long " flags );
46 .sp
47 .\"O Link with \fI\-lnuma\fP.
48 \fI\-lnuma\fP でリンクする。
49 .fi
50 .\"O .SH DESCRIPTION
51 .SH 説明
52 .\"O .BR get_mempolicy ()
53 .\"O retrieves the NUMA policy of the calling process or of a memory address,
54 .\"O depending on the setting of
55 .\"O .IR flags .
56 .BR get_mempolicy ()
57 は、呼び出し元プロセスもしくは指定されたメモリアドレスの
58 NUMA ポリシーを
59 .I flags
60 の設定に従って取得する。
61
62 .\"O A NUMA machine has different
63 .\"O memory controllers with different distances to specific CPUs.
64 .\"O The memory policy defines from which node memory is allocated for
65 .\"O the process.
66 NUMA (非対称メモリアクセス) マシンでは、CPU により
67 メモリコントローラが異なり、距離も異なっている。
68 メモリポリシーは、どのノードからメモリをそのプロセスに
69 割り当てるかを定めるものである。
70
71 .\"O If
72 .\"O .I flags
73 .\"O is specified as 0,
74 .\"O then information about the calling process's default policy
75 .\"O (as set by
76 .\"O .BR set_mempolicy (2))
77 .\"O is returned.
78 .I flags
79 に 0 が指定された場合、
80 .RB ( set_mempolicy (2)
81 で設定された)
82 呼び出し元プロセスのデフォルトポリシーに関する情報を返す。
83 .\"O The policy returned
84 .\"O .RI [ mode
85 .\"O and
86 .\"O .IR nodemask ]
87 .\"O may be used to restore the process's policy to its state at
88 .\"O the time of the call to
89 .\"O .BR get_mempolicy ()
90 .\"O using
91 .\"O .BR set_mempolicy (2).
92 返されたポリシー
93 .RI [ mode
94
95 .IR nodemask ]
96
97 .BR set_mempolicy (2)
98 に渡すことで、そのプロセスのポリシーを
99 .BR get_mempolicy ()
100 を呼び出した時点の状態に戻すことができる。
101
102 .\"O If
103 .\"O .I flags
104 .\"O specifies
105 .\"O .BR MPOL_F_MEMS_ALLOWED
106 .\"O (available since Linux 2.6.24), the
107 .\"O .I mode
108 .\"O argument is ignored and the set of nodes [memories] that the
109 .\"O process is allowed to specify in subsequent calls to
110 .\"O .BR mbind (2)
111 .\"O or
112 .\"O .BR set_mempolicy (2)
113 .\"O [in the absence of any
114 .\"O .IR "mode flags" ]
115 .\"O is returned in
116 .\"O .IR nodemask .
117 .\"O It is not permitted to combine
118 .\"O .B MPOL_F_MEMS_ALLOWED
119 .\"O with either
120 .\"O .B MPOL_F_ADDR
121 .\"O or
122 .\"O .BR MPOL_F_NODE .
123 .I flags
124
125 .B MPOL_F_MEMS_ALLOWED
126 (Linux 2.6.24 以降で利用可能) を指定すると、
127 .I mode
128 引き数は無視され、
129 そのプロセスがその後の
130 .BR mbind (2)
131
132 .BR set_mempolicy (2)
133
134 .RI [ "モードフラグ"
135 が指定されていない場合に ] 指定できるノード (メモリ) の集合が
136 .I nodemask
137 に返される。
138 .B MPOL_F_MEMS_ALLOWED
139 を、
140 .B MPOL_F_ADDR
141
142 .B MPOL_F_NODE
143 と同時に指定することはできない。
144
145 .\"O If
146 .\"O .I flags
147 .\"O specifies
148 .\"O .BR MPOL_F_ADDR ,
149 .\"O then information is returned about the policy governing the memory
150 .\"O address given in
151 .\"O .IR addr .
152 .\"O This policy may be different from the process's default policy if
153 .\"O .BR mbind (2)
154 .\"O or one of the helper functions described in
155 .\"O .BR numa (3)
156 .\"O has been used to establish a policy for the memory range containing
157 .\"O .IR addr .
158 .I flags
159
160 .B MPOL_F_ADDR
161 が指定された場合、
162 .I addr
163 で指定されたメモリアドレスに適用されているポリシーに関する情報を返す。
164 .BR mbind (2)
165
166 .BR numa (3)
167 で説明されているヘルパー関数を使って、
168 .I addr
169 を含むメモリ領域に対するポリシーが設定されていた場合には、
170 返されるポリシーはプロセスのデフォルトポリシーと違うことがある。
171
172 .\"O If the
173 .\"O .I mode
174 .\"O argument is not NULL, then
175 .\"O .BR get_mempolicy ()
176 .\"O will store the policy mode and any optional
177 .\"O .I "mode flags"
178 .\"O of the requested NUMA policy in the location pointed to by this argument.
179 .I mode
180 引き数が NULL でない場合、
181 .BR get_mempolicy ()
182 は要求された NUMA ポリシーのモードと追加の
183 .I "モードフラグ"
184
185 .I mode
186 が指す場所に格納する。
187 .\"O If
188 .\"O .I nodemask
189 .\"O is not NULL, then the nodemask associated with the policy will be stored
190 .\"O in the location pointed to by this argument.
191 .\"O .I maxnode
192 .\"O specifies the number of node IDs
193 .\"O that can be stored into
194 .\"O .IR nodemask \(emthat
195 .\"O is, the maximum node ID plus one.
196 .\"O The value specified by
197 .\"O .I maxnode
198 .\"O is always rounded to a multiple of
199 .\"O .IR "sizeof(unsigned long)" .
200 .I nodemask
201 が NULL 以外の場合、そのポリシーに対応するノードマスクを
202 この引き数が指す場所に格納する。
203 .I maxnode
204 には
205 .I nodemask
206 に格納できるノード ID の数、つまり最大ノード ID に 1 を足した値を指定する。
207 .I maxnode
208 で指定された値は常に
209 .I sizeof(unsigned long)
210 の倍数に切り上げられる。
211
212 .\"O If
213 .\"O .I flags
214 .\"O specifies both
215 .\"O .B MPOL_F_NODE
216 .\"O and
217 .\"O .BR MPOL_F_ADDR ,
218 .\"O .BR get_mempolicy ()
219 .\"O will return the node ID of the node on which the address
220 .\"O .I addr
221 .\"O is allocated into the location pointed to by
222 .\"O .IR mode .
223 .\"O If no page has yet been allocated for the specified address,
224 .\"O .BR get_mempolicy ()
225 .\"O will allocate a page as if the process had performed a read
226 .\"O [load] access to that address, and return the ID of the node
227 .\"O where that page was allocated.
228 .I flags
229
230 .B MPOL_F_NODE
231
232 .B MPOL_F_ADDR
233 の両方が指定された場合、
234 .BR get_mempolicy ()
235 はアドレス
236 .I addr
237 が割り当てられているノードのノード ID を
238 .I mode
239 が指す場所に入れて返す。
240 指定されたアドレスにどのページもまだ割り当てられていない場合、
241 .BR get_mempolicy ()
242 は、あたかもそのプロセスがそのアドレスに対して読み込みアクセスを
243 実行したかのようにページの割り当てを行い、ページが割り当てられた
244 ノードの ID を返す。
245
246 .\"O If
247 .\"O .I flags
248 .\"O specifies
249 .\"O .BR MPOL_F_NODE ,
250 .\"O but not
251 .\"O .BR MPOL_F_ADDR ,
252 .\"O and the process's current policy is
253 .\"O .BR MPOL_INTERLEAVE ,
254 .\"O then
255 .\"O .BR get_mempolicy ()
256 .\"O will return in the location pointed to by a non-NULL
257 .\"O .I mode
258 .\"O argument,
259 .\"O the node ID of the next node that will be used for
260 .\"O interleaving of internal kernel pages allocated on behalf of the process.
261 .I flags
262
263 .B MPOL_F_NODE
264 は指定されたが、
265 .B MPOL_F_ADDR
266 は指定されていない場合で、かつ
267 そのプロセスの現在のポリシーが
268 .B MPOL_INTERLEAVE
269 の場合、
270 .BR get_mempolicy ()
271 は、そのプロセスに対して割り当てられたカーネルの内部ページで
272 次にインターリーブ用に使用されるノードのノード ID を、
273 NULL でない
274 .I mode
275 引き数が指す場所に入れて返す。
276 .\" Note:  code returns next interleave node via 'mode' argument -Lee Schermerhorn
277 .\"O These allocations include pages for memory mapped files in
278 .\"O process memory ranges mapped using the
279 .\"O .BR mmap (2)
280 .\"O call with the
281 .\"O .B MAP_PRIVATE
282 .\"O flag for read accesses, and in memory ranges mapped with the
283 .\"O .B MAP_SHARED
284 .\"O flag for all accesses.
285 読み込みアクセス用として
286 .B MAP_PRIVATE
287 フラグ付きで
288 .BR mmap (2)
289 したプロセスメモリ領域や、
290 任意のアクセス用として
291 .B MAP_SHARED
292 フラグ付きで
293 .BR mmap (2)
294 したメモリ領域の、メモリマップされたファイルに対するページも
295 上記のプロセスに対して割り当てられたページに含まれる。
296
297 .\"O Other flag values are reserved.
298 他のフラグは予約されている。
299
300 .\"O For an overview of the possible policies see
301 .\"O .BR set_mempolicy (2).
302 設定可能なポリシーの概要については
303 .BR set_mempolicy (2)
304 を参照。
305 .\"O .SH RETURN VALUE
306 .SH 返り値
307 .\"O On success,
308 .\"O .BR get_mempolicy ()
309 .\"O returns 0;
310 .\"O on error, \-1 is returned and
311 .\"O .I errno
312 .\"O is set to indicate the error.
313 成功すると、
314 .BR get_mempolicy ()
315 は 0 を返す。エラーの場合、\-1 を返し、
316 .I errno
317 にエラーを示す値を設定する。
318 .\"O .SH ERRORS
319 .SH エラー
320 .TP
321 .B EFAULT
322 .\"O Part of all of the memory range specified by
323 .\"O .I nodemask
324 .\"O and
325 .\"O .I maxnode
326 .\"O points outside your accessible address space.
327 .\"motoki: Part of all of the memory は Part or all .. の間違い?
328 .I nodemask
329
330 .I maxnode
331 で指定されたメモリ領域の一部または全部が、
332 呼び出し元がアクセス可能なアドレス空間外を指している。
333 .TP
334 .B EINVAL
335 .\"O The value specified by
336 .\"O .I maxnode
337 .\"O is less than the number of node IDs supported by the system.
338 .I maxnode
339 で指定された値がシステムがサポートするノード ID の数よりも少ない。
340 .\"O Or
341 .\"O .I flags
342 .\"O specified values other than
343 .\"O .B MPOL_F_NODE
344 .\"O or
345 .\"O .BR MPOL_F_ADDR ;
346 または、
347 .I flags
348
349 .B MPOL_F_NODE
350 でも
351 .B MPOL_F_ADDR
352 でもない値が指定された。
353 .\"O or
354 .\"O .I flags
355 .\"O specified
356 .\"O .B MPOL_F_ADDR
357 .\"O and
358 .\"O .I addr
359 .\"O is NULL,
360 または、
361 .I flags
362
363 .B MPOL_F_ADDR
364 が指定されており、
365 .I addr
366 が NULL である。
367 .\"O or
368 .\"O .I flags
369 .\"O did not specify
370 .\"O .B MPOL_F_ADDR
371 .\"O and
372 .\"O .I addr
373 .\"O is not NULL.
374 または、
375 .I flags
376
377 .B MPOL_F_ADDR
378 がされておらず、
379 .I addr
380 が NULL でない。
381 .\"O Or,
382 .\"O .I flags
383 .\"O specified
384 .\"O .B MPOL_F_NODE
385 .\"O but not
386 .\"O .B MPOL_F_ADDR
387 .\"O and the current process policy is not
388 .\"O .BR MPOL_INTERLEAVE .
389 または、
390 .I flags
391
392 .B MPOL_F_NODE
393 が指定されており、
394 .B MPOL_F_ADDR
395 が指定されておらず、
396 プロセスの現在のポリシーが
397 .B MPOL_INTERLEAVE
398 でない。
399 .\"O Or,
400 .\"O .I flags
401 .\"O specified
402 .\"O .B MPOL_F_MEMS_ALLOWED
403 .\"O with either
404 .\"O .B MPOL_F_ADDR
405 .\"O or
406 .\"O .BR MPOL_F_NODE .
407 または、
408 .I flags
409
410 .B MPOL_F_MEMS_ALLOWED
411 が指定されており、さらに
412 .B MPOL_F_ADDR
413
414 .B MPOL_F_NODE
415 のいずれかが指定されている。
416 .\"O (And there are other
417 .\"O .B EINVAL
418 .\"O cases.)
419 (他にも
420 .B EINVAL
421 となる場合がある。)
422 .\"O .SH VERSIONS
423 .SH バージョン
424 .\"O The
425 .\"O .BR get_mempolicy ()
426 .\"O system call was added to the Linux kernel in version 2.6.7.
427 .BR get_mempolicy ()
428 システムコールはバージョン 2.6.7 で Linux カーネルに追加された。
429 .\"O .SH CONFORMING TO
430 .SH 準拠
431 .\"O This system call is Linux-specific.
432 このシステムコールは Linux 固有である。
433 .\"O .SH NOTES
434 .SH 注意
435 .\"O For information on library support, see
436 .\"O .BR numa (7).
437 ライブラリによるサポートについては
438 .BR numa (7)
439 を参照。
440 .\"O .SH SEE ALSO
441 .SH 関連項目
442 .BR getcpu (2),
443 .BR mbind (2),
444 .BR mmap (2),
445 .BR set_mempolicy (2),
446 .BR numa (3),
447 .BR numa (7),
448 .BR numactl (8)