On 03/25/2014 05:01 AM, Lennart Poettering wrote:
> On Tue, 25.03.14 01:03, WaLyong Cho (walyong....@samsung.com) wrote:
> 
>>          /* Figure out which controllers we need */
>>  
>> -        if (c->cpu_accounting || c->cpu_shares != 1024)
>> +        if (c->cpu_accounting ||
>> +            c->startup_cpu_shares != 1024 ||
>> +            (manager_state(m) != MANAGER_STARTING && c->cpu_shares !=
>> 1024))
> 
> This looks incorrect. Shouldn't it be like this:
> 
> ...
> 
> if (c->cpu_accounting ||
>     (manager->state(m) == MANAGER_STARTING ? c->startup_cpu_shares : 
> c->cpu_shares) != 1024)
> 

At previous patch, I also wrote similar with your thought. Assume, some
of units just only specified StartupCPUShares=(or
StartupBlockIOWeight=). In this case, that unit will not be changed to
default weight because global state is already changed to running. So I
put startup_cpu_shares condition alone.
Obviously, if we just only check condition for "c->startup_cpu_shares !=
1024" then that cgroup will always return mask with "CGROUP_CPUACCT |
CGROUP_CPU".
If should be NOT then we can make contition using boolean set like this:

if (c->cpu_accounting ||
    (manager_state(m) == MANAGER_STARTING ? c->startup_cpu_shares :
c->cpu_shares) != 1024 ||
    (manager_state(m) != MANAGER_STARTING && c->startup_cpu_shares_set
&& c->startup_cpu_shares != c->cpu_shares)) {
        mask |= CGROUP_CPUACCT | CGROUP_CPU;
        if (manager_state(m) != MANAGER_STARTING)
                c->startup_cpu_shares_set = false;
}

But it looks not so good idea.
Is there any good option?

...

Best Regards, WaLyong Cho
_______________________________________________
systemd-devel mailing list
systemd-devel@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/systemd-devel

Reply via email to