Search

3.2.3. Example Usage

download PDF

Example 3.2. Limiting CPU access

The following examples assume you have an existing hierarchy of cgroups configured and the cpu subsystem mounted on your system:
  • To allow one cgroup to use 25% of a single CPU and a different cgroup to use 75% of that same CPU, use the following commands:
    ~]# echo 250 > /cgroup/cpu/blue/cpu.shares
    ~]# echo 750 > /cgroup/cpu/red/cpu.shares
  • To limit a cgroup to fully utilize a single CPU, use the following commands:
    ~]# echo 10000 > /cgroup/cpu/red/cpu.cfs_quota_us
    ~]# echo 10000 > /cgroup/cpu/red/cpu.cfs_period_us
  • To limit a cgroup to utilize 10% of a single CPU, use the following commands:
    ~]# echo 10000 > /cgroup/cpu/red/cpu.cfs_quota_us
    ~]# echo 100000 > /cgroup/cpu/red/cpu.cfs_period_us
  • On a multi-core system, to allow a cgroup to fully utilize two CPU cores, use the following commands:
    ~]# echo 200000 > /cgroup/cpu/red/cpu.cfs_quota_us
    ~]# echo 100000 > /cgroup/cpu/red/cpu.cfs_period_us
Red Hat logoGithubRedditYoutubeTwitter

Learn

Try, buy, & sell

Communities

About Red Hat Documentation

We help Red Hat users innovate and achieve their goals with our products and services with content they can trust.

Making open source more inclusive

Red Hat is committed to replacing problematic language in our code, documentation, and web properties. For more details, see the Red Hat Blog.

About Red Hat

We deliver hardened solutions that make it easier for enterprises to work across platforms and environments, from the core datacenter to the network edge.

© 2024 Red Hat, Inc.