[systemd-devel] [PATCH] core: add startup resource control option
WaLyong Cho
walyong.cho at samsung.com
Mon Apr 21 04:46:14 PDT 2014
On 03/26/2014 12:12 AM, WaLyong Cho wrote:
> On 03/25/2014 05:01 AM, Lennart Poettering wrote:
>> On Tue, 25.03.14 01:03, WaLyong Cho (walyong.cho at 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?
>
Is there any comments for this?
> ...
>
> Best Regards, WaLyong Cho
>
More information about the systemd-devel
mailing list