Aneesh Kumar K.V | 585e27e | 2012-07-31 16:42:30 -0700 | [diff] [blame] | 1 | HugeTLB Controller |
| 2 | ------------------- |
| 3 | |
| 4 | The HugeTLB controller allows to limit the HugeTLB usage per control group and |
| 5 | enforces the controller limit during page fault. Since HugeTLB doesn't |
| 6 | support page reclaim, enforcing the limit at page fault time implies that, |
| 7 | the application will get SIGBUS signal if it tries to access HugeTLB pages |
| 8 | beyond its limit. This requires the application to know beforehand how much |
| 9 | HugeTLB pages it would require for its use. |
| 10 | |
| 11 | HugeTLB controller can be created by first mounting the cgroup filesystem. |
| 12 | |
| 13 | # mount -t cgroup -o hugetlb none /sys/fs/cgroup |
| 14 | |
| 15 | With the above step, the initial or the parent HugeTLB group becomes |
| 16 | visible at /sys/fs/cgroup. At bootup, this group includes all the tasks in |
| 17 | the system. /sys/fs/cgroup/tasks lists the tasks in this cgroup. |
| 18 | |
| 19 | New groups can be created under the parent group /sys/fs/cgroup. |
| 20 | |
| 21 | # cd /sys/fs/cgroup |
| 22 | # mkdir g1 |
| 23 | # echo $$ > g1/tasks |
| 24 | |
| 25 | The above steps create a new group g1 and move the current shell |
| 26 | process (bash) into it. |
| 27 | |
| 28 | Brief summary of control files |
| 29 | |
| 30 | hugetlb.<hugepagesize>.limit_in_bytes # set/show limit of "hugepagesize" hugetlb usage |
| 31 | hugetlb.<hugepagesize>.max_usage_in_bytes # show max "hugepagesize" hugetlb usage recorded |
| 32 | hugetlb.<hugepagesize>.usage_in_bytes # show current res_counter usage for "hugepagesize" hugetlb |
| 33 | hugetlb.<hugepagesize>.failcnt # show the number of allocation failure due to HugeTLB limit |
| 34 | |
| 35 | For a system supporting two hugepage size (16M and 16G) the control |
| 36 | files include: |
| 37 | |
| 38 | hugetlb.16GB.limit_in_bytes |
| 39 | hugetlb.16GB.max_usage_in_bytes |
| 40 | hugetlb.16GB.usage_in_bytes |
| 41 | hugetlb.16GB.failcnt |
| 42 | hugetlb.16MB.limit_in_bytes |
| 43 | hugetlb.16MB.max_usage_in_bytes |
| 44 | hugetlb.16MB.usage_in_bytes |
| 45 | hugetlb.16MB.failcnt |