+.\" This man page is Copyright (C) 2006 Andi Kleen <ak@muc.de>.
+.\" Permission is granted to distribute possibly modified copies
+.\" of this page provided the header is included verbatim,
+.\" and in case of nontrivial modification author and date
+.\" of the modification is added to the header.
+.\" 2008, mtk, various edits
+.\"*******************************************************************
+.\"
+.\" This file was generated with po4a. Translate the source file.
+.\"
+.\"*******************************************************************
+.TH GETCPU 2 2008\-06\-03 Linux "Linux Programmer's Manual"
+.SH 名前
+getcpu \- 呼び出し元スレッドが動作している CPU と NUMA ノードを判定する
+.SH 書式
+.nf
+\fB#include <linux/getcpu.h>\fP
+.sp
+\fBint getcpu(unsigned *\fP\fIcpu\fP\fB, unsigned *\fP\fInode\fP\fB, struct getcpu_cache *\fP\fItcache\fP\fB);\fP
+.fi
+.SH 説明
+\fBgetcpu\fP() システムコールは、呼び出し元のスレッドやプロセスが
+現在動作しているプロセッサやノードの情報を特定し、
+それぞれ引き数 \fIcpu\fP と \fInode\fP が指す整数に書き込む。
+プロセッサ情報は CPU を識別するための一意な小さな整数である。
+ノード情報は NUMAノードを識別するための一意な小さな整数である。
+\fIcpu\fP か \fInode\fP のいずれかが NULL であれば、
+その引き数に対応する情報の書き込みは行われない。
+
+このシステムコールの 3 番目の引き数は現在は使われていない。
+
+\fIcpu\fP に格納された情報が最新だと保証できるのは、システムコールが呼ばれ
+た時点だけである。\fBsched_setaffinity\fP(2) を使って CPU affinity が固定
+されていない限り、カーネルはいつでも CPU を変更してもよい (スケジューラ
+はキャッシュが有効に働くように CPU の移動を最小限にしようとするので、
+通常は CPU が変更されることはないが、起きる可能性はある)。
+呼び出し元は、 \fIcpu\fP や \fInode\fP で得られた情報がすでに現在の CPU や
+ノードの情報とは異なっている状況を扱えるようにしておかなければならない。
+.SH バージョン
+\fBgetcpu\fP() はカーネル 2.6.19 で x86_64 と i386 向けに追加された.
+.SH 準拠
+\fBgetcpu\fP() は Linux 固有である。
+.SH 注意
+Linux はこのシステムコールを可能な限り早く実行しようとする。
+\fBgetcpu\fP() は、CPU 毎のデータに対する最適化や NUMA 環境での最適化を
+プログラムが行えるようにすることを目的として実装されているからである。
+
+glibc はこのシステムコールに対するラッパー関数を提供していない。
+\fBsyscall\fP(2) を使って呼び出すか、
+代わりに \fBsched_getcpu\fP(3) を使用すること。
+
+.\" commit 4307d1e5ada595c87f9a4d16db16ba5edb70dcb1
+.\" Author: Ingo Molnar <mingo@elte.hu>
+.\" Date: Wed Nov 7 18:37:48 2007 +0100
+.\" x86: ignore the sys_getcpu() tcache parameter
+.\"
+.\" ===== Before kernel 2.6.24: =====
+.\" .I tcache
+.\" is a pointer to a
+.\" .IR "struct getcpu_cache"
+.\" that is used as a cache by
+.\" .BR getcpu ().
+.\" The caller should put the cache into a thread-local variable
+.\" if the process is multithreaded,
+.\" because the cache cannot be shared between different threads.
+.\" .I tcache
+.\" can be NULL.
+.\" If it is not NULL
+.\" .BR getcpu ()
+.\" will use it to speed up operation.
+.\" The information inside the cache is private to the system call
+.\" and should not be accessed by the user program.
+.\" The information placed in the cache can change between kernel releases.
+.\"
+.\" When no cache is specified
+.\" .BR getcpu ()
+.\" will be slower,
+.\" but always retrieve the current CPU and node information.
+.\" With a cache
+.\" .BR getcpu ()
+.\" is faster.
+.\" However, the cached information is only updated once per jiffy (see
+.\" .BR time (7)).
+.\" This means that the information could theoretically be out of date,
+.\" although in practice the scheduler's attempt to maintain
+.\" soft CPU affinity means that the information is unlikely to change
+.\" over the course of the caching interval.
+\fItcache\fP 引き数は Linux 2.6.24 以降では使用されない。以前のバージョン
+のカーネルでは、この引き数が NULL 以外の場合、この引き数には、呼び出し
+元が割り当てたスレッド専用の記憶領域 (thread\-local storage) 内のバッファ
+を指すポインタが指定され、このバッファは \fBgetcpu\fP() 用のキャッシュ機構
+を提供するために利用されていた。非常に低い確率だが古い情報を返してしま
+うデメリットはあるものの、このキャッシュを使うことで \fBgetcpu\fP() システ
+ムコールを高速化できた。このキャッシュ機構はCPU 間でのスレッドの移動時
+に問題になると考えられ、この引き数は今では無視されるようになっている。
+.SH 関連項目
+\fBmbind\fP(2), \fBsched_setaffinity\fP(2), \fBset_mempolicy\fP(2),
+\fBsched_getcpu\fP(3), \fBcpuset\fP(7)
+.SH この文書について
+この man ページは Linux \fIman\-pages\fP プロジェクトのリリース 3.40 の一部
+である。プロジェクトの説明とバグ報告に関する情報は
+http://www.kernel.org/doc/man\-pages/ に書かれている。