.\" Copyright 2003 Andries E. Brouwer (aeb@cwi.nl) .\" .\" %%%LICENSE_START(VERBATIM) .\" 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. The author(s) may not .\" have taken the same level of care in the production of this manual, .\" which is licensed free of charge, as they might when working .\" professionally. .\" .\" Formatted or processed versions of this manual, if unaccompanied by .\" the source, must acknowledge the copyright and authors of this work. .\" %%%LICENSE_END .\" .\"******************************************************************* .\" .\" This file was generated with po4a. Translate the source file. .\" .\"******************************************************************* .\" .\" Japanese Version Copyright (c) 2004 Yuichi SATO .\" all rights reserved. .\" Translated 2004-06-06, Yuichi SATO .\" Updated 2007-06-11, Akihiro MOTOKI , LDP v2.54 .\" .TH ALLOC_HUGEPAGES 2 2017\-09\-15 Linux "Linux Programmer's Manual" .SH 名前 alloc_hugepages, free_hugepages \- 大きなサイズのページの割り当てと解放を行う .SH 書式 .nf .\" asmlinkage unsigned long sys_alloc_hugepages(int key, unsigned long addr, .\" unsigned long len, int prot, int flag); \fBvoid *alloc_hugepages(int \fP\fIkey\fP\fB, void *\fP\fIaddr\fP\fB, size_t \fP\fIlen\fP\fB,\fP \fB int \fP\fIprot\fP\fB, int \fP\fIflag\fP\fB);\fP .PP .\" asmlinkage int sys_free_hugepages(unsigned long addr); \fBint free_hugepages(void *\fP\fIaddr\fP\fB);\fP .fi .SH 説明 システムコール \fBalloc_hugepages\fP() と \fBfree_hugepages\fP() は Linux 2.5.36 で導入され、2.5.54 で再び削除された。 これらのシステムコールは i386 と ia64 のみで (かつ \fBCONFIG_HUGETLB_PAGE\fP を指定してビルドされた場合に) 存在する。 Linux 2.4.20 では syscall 番号が存在するが、 呼び出すとエラー \fBENOSYS\fP で失敗する。 .PP i386 では、メモリー管理ハードウェアは通常のページ (4\ KiB) と 大きなサイズのページ (以下、ヒュージページ; 2MiB または 4\ MiB) を 扱うことができる。 同様に、ia64 もいくつかのサイズのヒュージページを扱うことができる。 これらのシステムコールは、ヒュージページをプロセスのメモリーにマップしたり、 再び解放したりする。 ヒュージページはメモリー内にロックされ、スワップされない。 .PP \fIkey\fP 引数は識別子である。 0 の場合、ページは非公開になり、子プロセスに継承されない。 正の場合、ページは同じ \fIkey\fP を使う他のアプリケーションと共有され、子プロセスに継承される。 .PP \fBfree_hugepages\fP() の \fIaddr\fP 引数は、どのページを解放するかを指定する: \fIaddr\fP は \fBalloc_hugepages\fP() の呼び出しの返り値である (全てのユーザーがメモリーを解放したときに、 そのメモリーは初めて実際に解放される)。 \fBalloc_hugepages\fP() の \fIaddr\fP 引数はヒントであり、カーネルはそれに従うかもしれないし、 従わないかもしれない。 アドレスは正しく配置されなければならない。 .PP \fIlen\fP 引数は要求されたセグメントの長さである。 これはヒュージページのサイズの倍数にしなければならない。 .PP \fIprot\fP 引数はセグメントのメモリー保護を指定する。 これは \fBPROT_READ\fP, \fBPROT_WRITE\fP, \fBPROT_EXEC\fP のいずれかである。 .PP \fIkey\fP が正でない限り、 \fIflag\fP 引数は無視される。 \fIkey\fP が正で、かつ \fIflag\fP が \fBIPC_CREAT\fP であり、かつ指定された \fIkey\fP で (セグメントが) 何も存在しない場合、 新しいヒュージページセグメントが作成される。 \fIflag\fP が設定されておらず、かつ指定された \fIkey\fP のセグメントが存在しない場合、 \fBENOENT\fP が返される。 .SH 返り値 成功した場合、 \fBalloc_hugepages\fP() は割り当てられた仮想アドレスを返し、 \fBfree_hugepages\fP() は 0 を返す。 失敗した場合、\-1 を返し、 \fIerrno\fP が適切に設定される。 .SH エラー .TP \fBENOSYS\fP このシステムコールはカーネルでサポートされていない。 .SH ファイル .TP \fI/proc/sys/vm/nr_hugepages\fP 設定された hugetlb ページの数。 このファイルは読み書きできる。 .TP \fI/proc/meminfo\fP 設定された hugetlb ページの数と、 3 つの変数 HugePages_Total, HugePages_Free, Hugepagesize の サイズについての情報を提供する。 .SH 準拠 このシステムコールは Intel プロセッサ上の Linux に固有のものであり、 移植性が必要なプログラムで使うべきでない。 .SH 注意 これらのシステムコールはなくなった。 これらは Linux 2.5.36 から 2.5.54 にのみ存在する。 代わりに今は hugetlbfs ファイルシステムを使うことができる。 (CPU がサポートしている場合) ヒュージページを持つメモリーは、 \fBmmap\fP(2) を使ってこの仮想ファイルシステムでファイルをマップすることで取得できる。 .PP .\".PP .\" requires CONFIG_HUGETLB_PAGE (under "Processor type and features") .\" and CONFIG_HUGETLBFS (under "Filesystems"). .\" mount \-t hugetlbfs hugetlbfs /huge .\" SHM_HUGETLB ヒュージページの最大数は、 \fBhugepages=\fP 起動パラメーターを使って指定できる。 .SH この文書について この man ページは Linux \fIman\-pages\fP プロジェクトのリリース 5.10 の一部である。プロジェクトの説明とバグ報告に関する情報は \%https://www.kernel.org/doc/man\-pages/ に書かれている。