1 .\" Copyright 2003,2004 Andi Kleen, SuSE Labs.
2 .\" and Copyright 2007 Lee Schermerhorn, Hewlett Packard
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.
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.
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.
18 .\" Formatted or processed versions of this manual, if unaccompanied by
19 .\" the source, must acknowledge the copyright and authors of this work.
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.
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
33 .TH GET_MEMPOLICY 2 2008-08-15 Linux "Linux Programmer's Manual"
36 .\"O get_mempolicy \- Retrieve NUMA memory policy for a process
37 get_mempolicy \- プロセスの NUMA メモリのポリシーを取得する
41 .B "#include <numaif.h>"
43 .BI "int get_mempolicy(int *" mode ", unsigned long *" nodemask ,
44 .BI " unsigned long " maxnode ", unsigned long " addr ,
45 .BI " unsigned long " flags );
47 .\"O Link with \fI\-lnuma\fP.
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
57 は、呼び出し元プロセスもしくは指定されたメモリアドレスの
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
66 NUMA (非対称メモリアクセス) マシンでは、CPU により
67 メモリコントローラが異なり、距離も異なっている。
68 メモリポリシーは、どのノードからメモリをそのプロセスに
73 .\"O is specified as 0,
74 .\"O then information about the calling process's default policy
76 .\"O .BR set_mempolicy (2))
80 .RB ( set_mempolicy (2)
82 呼び出し元プロセスのデフォルトポリシーに関する情報を返す。
83 .\"O The policy returned
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 ()
91 .\"O .BR set_mempolicy (2).
100 を呼び出した時点の状態に戻すことができる。
105 .\"O .BR MPOL_F_MEMS_ALLOWED
106 .\"O (available since Linux 2.6.24), the
108 .\"O argument is ignored and the set of nodes [memories] that the
109 .\"O process is allowed to specify in subsequent calls to
112 .\"O .BR set_mempolicy (2)
113 .\"O [in the absence of any
114 .\"O .IR "mode flags" ]
117 .\"O It is not permitted to combine
118 .\"O .B MPOL_F_MEMS_ALLOWED
122 .\"O .BR MPOL_F_NODE .
125 .B MPOL_F_MEMS_ALLOWED
126 (Linux 2.6.24 以降で利用可能) を指定すると、
132 .BR set_mempolicy (2)
135 が指定されていない場合に ] 指定できるノード (メモリ) の集合が
138 .B MPOL_F_MEMS_ALLOWED
148 .\"O .BR MPOL_F_ADDR ,
149 .\"O then information is returned about the policy governing the memory
150 .\"O address given in
152 .\"O This policy may be different from the process's default policy if
154 .\"O or one of the helper functions described in
156 .\"O has been used to establish a policy for the memory range containing
163 で指定されたメモリアドレスに適用されているポリシーに関する情報を返す。
169 を含むメモリ領域に対するポリシーが設定されていた場合には、
170 返されるポリシーはプロセスのデフォルトポリシーと違うことがある。
174 .\"O argument is not NULL, then
175 .\"O .BR get_mempolicy ()
176 .\"O will store the policy mode and any optional
178 .\"O of the requested NUMA policy in the location pointed to by this argument.
182 は要求された NUMA ポリシーのモードと追加の
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.
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
198 .\"O is always rounded to a multiple of
199 .\"O .IR "sizeof(unsigned long)" .
201 が NULL 以外の場合、そのポリシーに対応するノードマスクを
206 に格納できるノード ID の数、つまり最大ノード ID に 1 を足した値を指定する。
209 .I sizeof(unsigned long)
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
221 .\"O is allocated into the location pointed to by
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.
237 が割り当てられているノードのノード ID を
240 指定されたアドレスにどのページもまだ割り当てられていない場合、
242 は、あたかもそのプロセスがそのアドレスに対して読み込みアクセスを
243 実行したかのようにページの割り当てを行い、ページが割り当てられた
249 .\"O .BR MPOL_F_NODE ,
251 .\"O .BR MPOL_F_ADDR ,
252 .\"O and the process's current policy is
253 .\"O .BR MPOL_INTERLEAVE ,
255 .\"O .BR get_mempolicy ()
256 .\"O will return in the location pointed to by a non-NULL
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.
271 は、そのプロセスに対して割り当てられたカーネルの内部ページで
272 次にインターリーブ用に使用されるノードのノード ID を、
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
282 .\"O flag for read accesses, and in memory ranges mapped with the
284 .\"O flag for all accesses.
294 したメモリ領域の、メモリマップされたファイルに対するページも
295 上記のプロセスに対して割り当てられたページに含まれる。
297 .\"O Other flag values are reserved.
300 .\"O For an overview of the possible policies see
301 .\"O .BR set_mempolicy (2).
303 .BR set_mempolicy (2)
305 .\"O .SH RETURN VALUE
308 .\"O .BR get_mempolicy ()
310 .\"O on error, \-1 is returned and
312 .\"O is set to indicate the error.
315 は 0 を返す。エラーの場合、\-1 を返し、
322 .\"O Part of all of the memory range specified by
326 .\"O points outside your accessible address space.
327 .\"motoki: Part of all of the memory は Part or all .. の間違い?
331 で指定されたメモリ領域の一部または全部が、
332 呼び出し元がアクセス可能なアドレス空間外を指している。
335 .\"O The value specified by
337 .\"O is less than the number of node IDs supported by the system.
339 で指定された値がシステムがサポートするノード ID の数よりも少ない。
342 .\"O specified values other than
345 .\"O .BR MPOL_F_ADDR ;
387 .\"O and the current process policy is not
388 .\"O .BR MPOL_INTERLEAVE .
402 .\"O .B MPOL_F_MEMS_ALLOWED
406 .\"O .BR MPOL_F_NODE .
410 .B MPOL_F_MEMS_ALLOWED
416 .\"O (And there are other
425 .\"O .BR get_mempolicy ()
426 .\"O system call was added to the Linux kernel in version 2.6.7.
428 システムコールはバージョン 2.6.7 で Linux カーネルに追加された。
429 .\"O .SH CONFORMING TO
431 .\"O This system call is Linux-specific.
432 このシステムコールは Linux 固有である。
435 .\"O For information on library support, see
445 .BR set_mempolicy (2),