Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

config-linux: add more info about hugetlb page size #1011

Merged
merged 1 commit into from
Jun 17, 2019
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 7 additions & 0 deletions config-linux.md
Original file line number Diff line number Diff line change
Expand Up @@ -394,6 +394,9 @@ For more information, see the kernel cgroups documentation about [HugeTLB][cgrou
Each entry has the following structure:

* **`pageSize`** *(string, REQUIRED)* - hugepage size
The value has the format "<size><unit-prefix>B" (64KB, 2MB, 1GB), and must match the <hugepagesize> of the
corresponding control file found in "/sys/fs/cgroup/hugetlb/hugetlb.<hugepagesize>.limit_in_bytes".
Values of <unit-prefix> are intended to be parsed using base 1024 ("1KB" = 1024, "1MB" = 1048576, etc).
* **`limit`** *(uint64, REQUIRED)* - limit in bytes of *hugepagesize* HugeTLB usage

#### Example
Expand All @@ -403,6 +406,10 @@ Each entry has the following structure:
{
"pageSize": "2MB",
"limit": 209715200
},
{
"pageSize": "64KB",
"limit": 1000000
}
]
```
Expand Down
4 changes: 4 additions & 0 deletions config.md
Original file line number Diff line number Diff line change
Expand Up @@ -710,6 +710,10 @@ Here is a full example `config.json` for reference.
{
"pageSize": "2MB",
"limit": 9223372036854772000
},
{
"pageSize": "64KB",
"limit": 1000000
}
],
"memory": {
Expand Down
3 changes: 2 additions & 1 deletion schema/config-linux.json
Original file line number Diff line number Diff line change
Expand Up @@ -124,7 +124,8 @@
"type": "object",
"properties": {
"pageSize": {
"type": "string"
"type": "string",
"pattern": "^[1-9][0-9]*[KMG]B$"
},
"limit": {
"$ref": "defs.json#/definitions/uint64"
Expand Down
16 changes: 16 additions & 0 deletions schema/test/config/bad/linux-hugepage.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
{
"ociVersion": "1.0.0",
"root": {
"path": "rootfs"
},
"linux": {
"resources": {
"hugepageLimits": [
{
"limit": 1234123,
"pageSize": "64kB"
}
]
}
}
}
4 changes: 4 additions & 0 deletions schema/test/config/good/spec-example.json
Original file line number Diff line number Diff line change
Expand Up @@ -232,6 +232,10 @@
{
"pageSize": "2MB",
"limit": 9223372036854772000
},
{
"pageSize": "64KB",
"limit": 1000000
}
],
"oomScoreAdj": 100,
Expand Down
1 change: 1 addition & 0 deletions specs-go/config.go
Original file line number Diff line number Diff line change
Expand Up @@ -219,6 +219,7 @@ type POSIXRlimit struct {
// LinuxHugepageLimit structure corresponds to limiting kernel hugepages
type LinuxHugepageLimit struct {
// Pagesize is the hugepage size
// Format: "<size><unit-prefix>B' (e.g. 64KB, 2MB, 1GB, etc.)
Pagesize string `json:"pageSize"`
// Limit is the limit of "hugepagesize" hugetlb usage
Limit uint64 `json:"limit"`
Expand Down