[PATCH 4/7] [RFC] Allow cgroup hierarchies to be created with no bound subsystems

Paul Menage menage at google.com
Tue Mar 31 01:45:57 PDT 2009


On Mon, Mar 16, 2009 at 11:45 PM, Li Zefan <lizf at cn.fujitsu.com> wrote:
>>
>> +static void init_root_id(struct cgroupfs_root *root)
>> +{
>> +     BUG_ON(!ida_pre_get(&hierarchy_ida, GFP_KERNEL));
>
> we should return -errno, BUG_ON() on this is wrong

Hmm. Fair enough in the new root case, since it's possible we'd not
get the memory then - I've changed init_root_id() to return false on
failure. But I think that in cgroup_init(), we need to
BUG_ON(!init_root_id()) - we shouldn't be able to fail that early in
boot and there's no sensible way to handle it if it happens.

>
>> +     spin_lock(&hierarchy_id_lock);
>> +     if (ida_get_new_above(&hierarchy_ida, next_hierarchy_id,
>> +                           &root->hierarchy_id)) {
>> +             BUG_ON(ida_get_new(&hierarchy_ida, &root->hierarchy_id));
>> +     }
>
> next_hierarchy_id is redundant, just use ida_get_new() instead of
> ida_get_new_above()



More information about the Containers mailing list