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 .\" Translated 2006-08-14, Akihiro MOTOKI <amotoki@dd.iij4u.or.jp>, LDP v2.39
26 .\" Updated 2007-01-07, Akihiro MOTOKI, LDP v2.43
27 .\" Updated 2008-02-13, Akihiro MOTOKI, LDP v2.77
28 .\" Updated 2008-08-06, Akihiro MOTOKI, LDP v3.05
29 .\" Updated 2008-08-21, Akihiro MOTOKI, LDP v3.07
30 .\" Updated 2008-09-02, Akihiro MOTOKI, LDP v3.08
31 .\" Updated 2008-11-19, Akihiro MOTOKI, LDP v3.13
33 .\"WORD: anonymous memory 無名メモリ
35 .TH SET_MEMPOLICY 2 2008-08-15 Linux "Linux Programmer's Manual"
38 .\"O set_mempolicy \- set default NUMA memory policy for a process and its children
39 set_mempolicy \- プロセスとその子プロセスの NUMA メモリの
44 .B "#include <numaif.h>"
46 .BI "int set_mempolicy(int " mode ", unsigned long *" nodemask ,
47 .BI " unsigned long " maxnode );
49 .\"O Link with \fI\-lnuma\fP.
54 .\"O .BR set_mempolicy ()
55 .\"O sets the NUMA memory policy of the calling process,
56 .\"O which consists of a policy mode and zero or more nodes,
57 .\"O to the values specified by the
64 は、呼び出し元プロセスの NUMA ポリシーを
67 NUMA ポリシーはポリシーモードと 0 個以上のノードから構成され、
74 .\"O A NUMA machine has different
75 .\"O memory controllers with different distances to specific CPUs.
76 .\"O The memory policy defines from which node memory is allocated for
78 NUMA (非対称メモリアクセス) マシンでは、CPU により
79 メモリコントローラが異なり、距離も異なっている。
80 メモリポリシーは、どのノードからメモリをそのプロセスに
83 .\"O This system call defines the default policy for the process.
84 .\"O The process policy governs allocation of pages in the process's
85 .\"O address space outside of memory ranges
86 .\"O controlled by a more specific policy set by
92 で設定される特定のポリシーにより制御されるメモリ領域以外の
93 プロセスのアドレス空間におけるページの割り当てに適用される。
94 .\"O The process default policy also controls allocation of any pages for
95 .\"O memory mapped files mapped using the
99 .\"O flag and that are only read [loaded] from by the process
100 .\"O and of memory mapped files mapped using the
104 .\"O flag, regardless of the access type.
109 を使ってマップされたメモリマップ・ファイルに対する読み出し専用
110 (ロードされるだけ) のページの割り当てにも適用される。
115 を使ってマップされたメモリマップ・ファイルに対するページの割り当てにも
116 適用される (この場合はページのアクセス種別に関わらず適用される) 。
117 .\"O The policy is only applied when a new page is allocated
118 .\"O for the process.
119 .\"O For anonymous memory this is when the page is first
120 .\"O touched by the application.
121 設定したポリシーは、プロセスに新規のページが割り当てられるときにのみ
122 適用される。無名メモリ (anonymous memory) の場合、新規ページの割り当ては
123 アプリケーションが初めてページにアクセスした際に行われる。
127 .\"O argument must specify one of
128 .\"O .BR MPOL_DEFAULT ,
130 .\"O .B MPOL_INTERLEAVE
132 .\"O .BR MPOL_PREFERRED .
133 .\"O All modes except
135 .\"O require the caller to specify via the
137 .\"O argument one or more nodes.
142 .BR MPOL_INTERLEAVE ,
144 のいずれか一つを指定してしなければならない。
148 引き数で一つ以上のノードを指定する必要がある。
152 .\"O argument may also include an optional
153 .\"O .IR "mode flag" .
165 .\"O .BR MPOL_F_STATIC_NODES " (since Linux 2.6.26)"
166 .BR MPOL_F_STATIC_NODES " (Linux 2.6.26 以降)"
169 .\"O specifies physical node ids.
170 .\"O Linux does will not remap the
172 .\"O when the process moves to a different cpuset context,
173 .\"O nor when the set of nodes allowed by the process's
174 .\"O current cpuset context changes.
178 Linux では、そのプロセスが異なる CPU 集合コンテキスト (cpuset context)
179 に移動した場合でも、そのプロセスの現在の CPU 集合コンテキストで
180 許可されているノード集合が変化した場合でも、
184 .\"O .BR MPOL_F_RELATIVE_NODES " (since Linux 2.6.26)"
185 .BR MPOL_F_RELATIVE_NODES " (Linux 2.6.26 以降)"
188 .\"O specifies node ids that are relative to the set of
189 .\"O node ids allowed by the process's current cpuset.
192 は、そのプロセスの現在の CPU 集合で許可されているノード ID 集合
196 .\"O points to a bit mask of node IDs that contains up to
199 .\"O The bit mask size is rounded to the next multiple of
200 .\"O .IR "sizeof(unsigned long)" ,
201 .\"O but the kernel will only use bits up to
206 ビットから構成されるノード ID のビットマスクを指す。
208 .I sizeof(unsigned long)
209 の倍数に切り上げられるが、カーネルが使用するのは
216 .\"O value of zero specifies the empty set of nodes.
222 .\"O argument is ignored.
235 .\"O is required, it must contain at least one node that is on-line,
236 .\"O allowed by the process's current cpuset context,
238 .\"O .B MPOL_F_STATIC_NODES
239 .\"O mode flag is specified],
240 .\"O and contains memory.
244 に、オンラインで、そのプロセスの現在の CPU 集合コンテキストで
246 .RB ( MPOL_F_STATIC_NODES
247 モードフラグが指定されていない場合)、メモリがあるノードが
250 .\"O .B MPOL_F_STATIC_NODES
255 .\"O contains no nodes that are allowed by the process's current cpuset context,
256 .\"O the memory policy reverts to
257 .\"O .IR "local allocation" .
258 .\"O This effectively overrides the specified policy until the process's
259 .\"O cpuset context includes one or more of the nodes specified by
263 .B MPOL_F_STATIC_NODES
268 に、そのプロセスの現在の CPU 集合コンテキストで許可されたノードが
269 一つも含まれていない場合には、メモリのポリシーとしてデフォルトの
270 「ローカルから割り当て (local allocation)」が適用される。
271 そのプロセスの CPU 集合コンテキストが
273 で指定されたノードを少なくとも一つ含むようになるまでは、
274 結果的に指定された動作が上書きされることになる。
278 .\"O mode specifies that any nondefault process memory policy be removed,
279 .\"O so that the memory policy "falls back" to the system default policy.
280 .\"O The system default policy is "local allocation"--
281 .\"O i.e., allocate memory on the node of the CPU that triggered the allocation.
283 .\"O must be specified as NULL.
284 .\"O If the "local node" contains no free memory, the system will
285 .\"O attempt to allocate memory from a "near by" node.
287 モードは、デフォルトではないプロセスのメモリポリシーを削除することを
288 指定するものである。これにより、メモリポリシーはシステムの
290 システムのデフォルトポリシーは「ローカルからの割り当て (local allocation)」、
291 つまりメモリ割り当てのきっかけとなった CPU のノードのメモリが割り当てられる。
293 には NULL を指定しなければならない。
294 「自ノード (local node)」に空きメモリが全くない場合、システムは
295 「近くの (near by) ノード」からメモリを割り当てようと試みる。
299 .\"O mode defines a strict policy that restricts memory allocation to the
300 .\"O nodes specified in
304 .\"O specifies more than one node, page allocations will come from
305 .\"O the node with the lowest numeric node ID first, until that node
306 .\"O contains no free memory.
307 .\"O Allocations will then come from the node with the next highest
308 .\"O node ID specified in
310 .\"O and so forth, until none of the specified nodes contain free memory.
311 .\"O Pages will not be allocated from any node not specified in the
314 モードは厳密なポリシーで、メモリ割り当ては
318 に 2 個以上のノードが指定された場合、ページの割り当ては
319 ノード ID が数字として最小のノードから開始され、
320 そのノードに空きメモリがなくなるまでそのノードから
321 ページ割り当てが行われる。そのノードに空きメモリがなくなったら、
322 .\"motoki: the next highest は the next lowest の間違い?
323 次に小さなノード ID を持つノードからページ割り当てが行われる。
326 で指定された全てのノードで空きメモリがなくなるまで繰り返す。
328 で指定された以外のノードからはページの割り当ては行われない。
330 .\"O .B MPOL_INTERLEAVE
331 .\"O interleaves page allocations across the nodes specified in
333 .\"O in numeric node ID order.
334 .\"O This optimizes for bandwidth instead of latency
335 .\"O by spreading out pages and memory accesses to those pages across
337 .\"O However, accesses to a single page will still be limited to
338 .\"O the memory bandwidth of a single node.
342 に指定されたノードの間でノード ID の数字順で交互に行う。
343 このポリシーでは、複数のノードにページを広げて配置し、これらのページへのメモリ
344 アクセスを分散することで、遅延ではなく、帯域を最適化する。
345 ただし、一つのページへのアクセスに関しては依然として一つのノードのメモリ帯域
347 .\" NOTE: the following sentence doesn't make sense in the context
348 .\" of set_mempolicy() -- no memory area specified.
349 .\" To be effective the memory area should be fairly large,
350 .\" at least 1MB or bigger.
352 .\"O .B MPOL_PREFERRED
353 .\"O sets the preferred node for allocation.
354 .\"O The kernel will try to allocate pages from this node first
355 .\"O and fall back to "near by" nodes if the preferred node is low on free
359 .\"O specifies more than one node ID, the first node in the
360 .\"O mask will be selected as the preferred node.
365 .\"O arguments specify the empty set, then the policy
366 .\"O specifies "local allocation"
367 .\"O (like the system default policy discussed above).
369 は、割り当て時に優先されるノード (preferred node) を設定する。
370 カーネルはまず優先ノードからページ割り当てを行おうとし、
371 優先ノードに空きメモリが少ない場合に「近くの (near by)」ノードから
374 に複数のノード ID が指定された場合は、
376 内の最初のノードが優先ノードとして選択される。
380 で空集合が指定された場合は、ポリシーは (上述のシステムの
381 デフォルトポリシーと同様に) 「ローカルからの割り当て」となる。
383 .\"O The process memory policy is preserved across an
385 .\"O and is inherited by child processes created using
395 を使って作成された子プロセスに継承される。
396 .\"O .SH RETURN VALUE
399 .\"O .BR set_mempolicy ()
401 .\"O on error, \-1 is returned and
403 .\"O is set to indicate the error.
406 は 0 を返す。エラーの場合、\-1 を返し、
413 .\"O Part of all of the memory range specified by
417 .\"O points outside your accessible address space.
418 .\"motoki: Part of all of the memory は Part or all .. の間違い?
422 で指定されたメモリ領域の一部または全部が、
423 呼び出し元がアクセス可能なアドレス空間外を指している。
448 .\"O .B MPOL_INTERLEAVE
462 .\"O specifies more than a page worth of bits.
464 で実際に意味があるビット数より多くのビット数が指定された。
467 .\"O specifies one or more node IDs that are
468 .\"O greater than the maximum supported node ID.
470 に、サポートされている最大ノード ID より大きいノードが指定された。
471 .\"O Or, none of the node IDs specified by
473 .\"O are on-line and allowed by the process's current cpuset context,
474 .\"O or none of the specified nodes contain memory.
476 に、オンラインで、かつそのプロセスの現在の CPU 集合コンテキストで
477 許可されているノードが一つも含まれていないか、
478 メモリを含むノードが一つも指定されていない。
481 .\"O argument specified both
482 .\"O .B MPOL_F_STATIC_NODES
484 .\"O .BR MPOL_F_RELATIVE_NODES .
487 .B MPOL_F_STATIC_NODES
489 .B MPOL_F_RELATIVE_NODES
493 .\"O Insufficient kernel memory was available.
494 利用可能なカーネルメモリが十分でなかった。
498 .\"O .BR set_mempolicy (),
499 .\"O system call was added to the Linux kernel in version 2.6.7.
501 システムコールはバージョン 2.6.7 で Linux カーネルに追加された。
502 .\"O .SH CONFORMING TO
504 .\"O This system call is Linux-specific.
505 このシステムコールは Linux 独自である。
508 .\"O Process policy is not remembered if the page is swapped out.
511 .\"O When such a page is paged back in, it will use the policy of
512 .\"O the process or memory range that is in effect at the time the
513 .\"O page is allocated.
514 スワップ・アウトされたページがページ・インする際にも、
515 ページ割り当て時に適用されるプロセスポリシーやメモリ領域ポリシーが
518 .\"O For information on library support, see
525 .BR get_mempolicy (2),