Skip to content
GitLab
  • Menu
Projects Groups Snippets
  • Help
    • Help
    • Support
    • Community forum
    • Submit feedback
  • Sign in
  • N Nomad
  • Project information
    • Project information
    • Activity
    • Labels
    • Members
  • Repository
    • Repository
    • Files
    • Commits
    • Branches
    • Tags
    • Contributors
    • Graph
    • Compare
    • Locked Files
  • Issues 0
    • Issues 0
    • List
    • Boards
    • Service Desk
    • Milestones
    • Requirements
  • Merge requests 0
    • Merge requests 0
  • CI/CD
    • CI/CD
    • Pipelines
    • Jobs
    • Schedules
    • Test Cases
  • Deployments
    • Deployments
    • Environments
    • Releases
  • Packages & Registries
    • Packages & Registries
    • Package Registry
    • Infrastructure Registry
  • Monitor
    • Monitor
    • Incidents
  • Analytics
    • Analytics
    • Value stream
    • CI/CD
    • Code review
    • Insights
    • Issue
    • Repository
  • Wiki
    • Wiki
  • Snippets
    • Snippets
  • Activity
  • Graph
  • Create a new issue
  • Jobs
  • Commits
  • Issue Boards
Collapse sidebar
  • 小 白蛋
  • Nomad
  • Repository
Switch branch/tag
  • nomad
  • .changelog
  • 11287.txt
Find file BlameHistoryPermalink
  • Mahmood Ali's avatar
    executor: set CpuWeight in cgroup-v2 (#11287) · feb450a3
    Mahmood Ali authored Oct 14, 2021
    Cgroup-v2 uses `cpu.weight` property instead of cpu shares:
    https://www.kernel.org/doc/html/latest/admin-guide/cgroup-v2.html#cpu-interface-files
    . And it uses a different range (i.e. `[1, 10000]`) from cpu.shares
    (i.e. `[2, 262144]`) to make things more interesting.
    
    Luckily, the libcontainer provides a helper function to perform the
    conversion
    [`ConvertCPUSharesToCgroupV2Value`](https://pkg.go.dev/github.com/opencontainers/runc@v1.0.2/libcontainer/cgroups#ConvertCPUSharesToCgroupV2Value).
    
    I have confirmed that docker/libcontainer performs the conversion as
    well in
    https://github.com/opencontainers/runc/blob/v1.0.2/libcontainer/specconv/spec_linux.go#L536-L541
    , and that CpuShares is ignored by libcontainer in
    https://github.com/opencontainers/runc/blob/v1.0.2/libcontainer/cgroups/fs2/cpu.go#L24-L29
    .
    feb450a3

免费DevSecOps平台,让您的项目体验完整的DevSecOps流程,让项目更安全