diff --git a/libcontainer/cgroups/fs/hugetlb.go b/libcontainer/cgroups/fs/hugetlb.go index 7f192a9ae29..a7d3a8700db 100644 --- a/libcontainer/cgroups/fs/hugetlb.go +++ b/libcontainer/cgroups/fs/hugetlb.go @@ -29,7 +29,7 @@ func (s *HugetlbGroup) Apply(d *data) error { func (s *HugetlbGroup) Set(path string, cgroup *configs.Cgroup) error { for _, hugetlb := range cgroup.HugetlbLimit { - if err := writeFile(path, strings.Join([]string{"hugetlb", hugetlb.Pagesize, "limit_in_bytes"}, "."), strconv.Itoa(hugetlb.Limit)); err != nil { + if err := writeFile(path, strings.Join([]string{"hugetlb", hugetlb.Pagesize, "limit_in_bytes"}, "."), strconv.FormatUint(hugetlb.Limit, 10)); err != nil { return err } } diff --git a/libcontainer/cgroups/fs/hugetlb_test.go b/libcontainer/cgroups/fs/hugetlb_test.go index 39c3ee650e7..29acbdc6350 100644 --- a/libcontainer/cgroups/fs/hugetlb_test.go +++ b/libcontainer/cgroups/fs/hugetlb_test.go @@ -33,7 +33,7 @@ func TestHugetlbSetHugetlb(t *testing.T) { ) helper.writeFileContents(map[string]string{ - limit: strconv.Itoa(hugetlbBefore), + limit: strconv.FormatUint(hugetlbBefore, 10), }) helper.CgroupData.c.HugetlbLimit = []*configs.HugepageLimit{ diff --git a/libcontainer/configs/hugepage_limit.go b/libcontainer/configs/hugepage_limit.go index 1cce8d09be9..d30216380b5 100644 --- a/libcontainer/configs/hugepage_limit.go +++ b/libcontainer/configs/hugepage_limit.go @@ -5,5 +5,5 @@ type HugepageLimit struct { Pagesize string `json:"page_size"` // usage limit for hugepage. - Limit int `json:"limit"` + Limit uint64 `json:"limit"` }