2009-03-16 10:56:19

by Rolando Martins

[permalink] [raw]
Subject: cgroup, RT cpu balance question

Hi,
I have one question regarding RT cpu balance using cgroup.

cgroup
echo 1 > cpuset.sched_load_balance

cgroup/2
echo 0 > cpuset.mems
echo 0-2 > cpuset.cpus
echo 450000 > cpu.rt_runtime_us

cgroup/3
echo 0 > cpuset.mems
echo 3 > cpuset.cpus
echo 450000 > cpu.rt_runtime_us


I have a small test that uses a loop to utilize 100% cpu (SCHED_FIFO).
When I run 2 tests on cgroup/3, it only uses bandwidth from cpu 3
(100%), the balancing isn't happening.
As I use the SCHED_FIFO, the 2 processes run sequentially.

Is this the expected behavior? Shouldn't the domains balance the spare
cpu bandwidth?

Thanks,
Rolando


2009-03-16 11:17:30

by Li Zefan

[permalink] [raw]
Subject: Re: cgroup, RT cpu balance question

Rolando Martins wrote:
> Hi,
> I have one question regarding RT cpu balance using cgroup.
>
> cgroup
> echo 1 > cpuset.sched_load_balance
>
> cgroup/2
> echo 0 > cpuset.mems
> echo 0-2 > cpuset.cpus
> echo 450000 > cpu.rt_runtime_us
>
> cgroup/3
> echo 0 > cpuset.mems
> echo 3 > cpuset.cpus
> echo 450000 > cpu.rt_runtime_us
>
>
> I have a small test that uses a loop to utilize 100% cpu (SCHED_FIFO).
> When I run 2 tests on cgroup/3, it only uses bandwidth from cpu 3
> (100%), the balancing isn't happening.
> As I use the SCHED_FIFO, the 2 processes run sequentially.
>
> Is this the expected behavior? Shouldn't the domains balance the spare
> cpu bandwidth?
>

Then what do you expect? You put the task into cgroup/3 in which the allowed
cpus are restricted to CPU3, so of cause the scheduler will never schedule
the task to run on other cpus.

Please refer to Documentation/cgroups/cpusets.txt for the usage of cpusets.

2009-03-16 11:19:09

by Dhaval Giani

[permalink] [raw]
Subject: Re: cgroup, RT cpu balance question

On Mon, Mar 16, 2009 at 10:56:04AM +0000, Rolando Martins wrote:
> Hi,
> I have one question regarding RT cpu balance using cgroup.
>
> cgroup
> echo 1 > cpuset.sched_load_balance
>
> cgroup/2
> echo 0 > cpuset.mems
> echo 0-2 > cpuset.cpus
> echo 450000 > cpu.rt_runtime_us
>
> cgroup/3
> echo 0 > cpuset.mems
> echo 3 > cpuset.cpus
> echo 450000 > cpu.rt_runtime_us
>
>
> I have a small test that uses a loop to utilize 100% cpu (SCHED_FIFO).
> When I run 2 tests on cgroup/3, it only uses bandwidth from cpu 3
> (100%), the balancing isn't happening.
> As I use the SCHED_FIFO, the 2 processes run sequentially.
>
> Is this the expected behavior? Shouldn't the domains balance the spare
> cpu bandwidth?
>

Yes, this is expected behavior. The cpuset has limited the task's allowed
CPUs to CPU 3. With that, it will use the bandwidth only from CPU 3. As
you noted, since the process are SCHED_FIFO, they will run sequentially.

--
regards,
Dhaval