Subject: Re: cgroup to allocate CPU resource
From: Nirmal Guhan <vavatutu@gmail.com>
Date: Wed, 16 Jun 2010 17:32:12 -0700
Wed, 16 Jun 2010 17:32:12 -0700
Setting cpu.shares helps a bit but it still uses all the CPU when it is idle
(which I believe is ok and due to CFS). But wondering why the below values
don't fetch the expected behavior ?

--Nirmal

On Tue, Jun 15, 2010 at 2:37 PM, Nirmal Guhan <vavatutu@gmail.com> wrote:

> Hi,
>
> Am trying to put a (hard)limit on the CPU util of two of my VPS.
> I set
> 1) VPS 1 :
> cpu.rt_period_us to 1000000
> cpu.rt_runtime_us to 500000
> cpuset.cpus to 1
> 2) VPS 2:
> cpu.rt_period_us to 1000000
> cpu.rt_runtime_us to 100000
> cpuset.cpus to 1
> Basically I want VPS1 to use not more than 50% of CPU and VPS2 not more
> than 10%. This doesn't seem to work. I can see these values are set
> correctly when I cat /dev/cgroup/<VPS> but when I do vtop I always see ~50%
> from each of the VPS (Am just executing a C program that goes on an infinite
> loop in both the VPS for testing).
>
> Could someone sched some light? Am referring to
> http://www.redhat.com/docs/en-US/Red_Hat_Enterprise_Linux/6-Beta/html/Resource_Management_Guide/cpu.htmlfor
the documentation.
>
> Thanks,
> Nirmal
>


Setting cpu.shares helps a bit but it still uses all the CPU when it is idle (which I believe is ok and due to CFS). But wondering why the below values don't fetch the expected behavior ?

--Nirmal

On Tue, Jun 15, 2010 at 2:37 PM, Nirmal Guhan <vavatutu@gmail.com> wrote:
Hi,

Am trying to put a (hard)limit on the CPU util of two of my VPS.
I set
1) VPS 1 :
cpu.rt period us to 1000000
cpu.rt runtime us to 500000
cpuset.cpus to 1
2) VPS 2:
cpu.rt period us to 1000000
cpu.rt runtime us to 100000
cpuset.cpus to 1
Basically I want VPS1 to use not more than 50% of CPU and VPS2 not more than 10%. This doesn't seem to work. I can see these values are set correctly when I cat /dev/cgroup/<VPS> but when I do vtop I always see ~50% from each of the VPS (Am just executing a C program that goes on an infinite loop in both the VPS for testing).

Could someone sched some light? Am referring to http://www.redhat.com/docs/en-US/Red Hat Enterprise Linux/6-Beta/html/Resource Management Guide/cpu.html for the documentation.

Thanks,
Nirmal